Question

I have an app called iTerminal on my iphone. I SSH into my amazon instance and start the server and it works great (It's a .jar file). However, the moment I exit the iTerminal app the server shuts down. What gives?! I thought the server is suppose to be running! The only way my server can shut down is if I issue an exit command. This does not make sense.

Was it helpful?

Solution

You need to detach the server process from your shell. Your server is a child process of the shell and the system terminates the shell's children when the shell exits.

One way to do this is is using nohup and running the process in the background from the shell like this:

nohup /your/server/command &

nohup becomes the child process and, as its name suggests, it will ignore the hangup (HUP) signal that is normally sent to a child process.

The & runs the command in the background so you get a shell prompt back. When you exit the shell the service should still be running as an independent process.

OTHER TIPS

I found out:

Just type 'screen' then run your server/command.

Now when you exit terminals, it doesn't kill the app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top