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 &