el_supremo
Group: Members
Posts: 5
Joined: July 2004 |
|
Posted: Aug. 20 2004,04:37 |
|
Quote | I was trying to run my script as myscript & (to run in background). On exiting ssh, my script would also exit and application would shutdown (still need to understand why). |
I don't know the specifics but I can perhaps point you in the right direction. It's something to do with the way that ssh handles the SIGHUP signal when you logout. When you run a script as "myscript &", a shell (ssh) is spawned in the background to execute the script commands. When you put the & on the java command in the script, the script itself is still executed by the foreground ssh until it gets to the java command which it then puts in the background. I think that when it puts a process like java in the background, it makes it immune to the SIGHUP signal so that when you log out it, the shell (ssh) will die but the java will keep running. However, it would appear that when it spawns a copy of itself (to do "myscript &") it does not make that immune to SIGHUP and so the script dies when you logout.
Best Wishes Pete
|