Continue to run script even when closing a remote shell

mplayer running from a command line prompt, vi...

Image via Wikipedia

When you run a remote shell (for example putty) and you start a remote cli program (e.g. tomcat, servicedesk, jboss and so on) when you close the remote shell normally they would terminate. To avoid this situation you can try to run the program in background (adding & at the end of the command or using the combination CTRL-Z and after the command bg)  but there are some cases in which the child process will continue to receive signal from the parent process (e.g. SIGINT), so you can overcome this by using the nohup command (which will cause the program to ignore signals sent from the shell).

Example think that you have a run.sh script to run,  to avoid to be interrupted when you close the remote shell just write this:

nohup run.sh &

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: