There’s a nasty little surprise in store for anyone running a script using nohup in bash (Bourne Again Shell) on Solaris (to prevent hangup signals from killing their script/processes in the event their ssh session gets disconnected).
The Solaris default shell is csh (C Shell) in /bin/sh and even if the script has #!/bin/sh at the top, if its run from bash with nohup, it won’t survive in the event the ssh session is disconnected. Be warned.
This is because of bash’s built in job control apparently. I haven’t delved any deeper than that, but i’m guessing the process isn’t immune to sighups so aren’t protected from termination by nohup.
scripts must be executed from within a regular csh shell, i.e.
root@solarisbox ~ $ nohup /full/path/to/myscript.sh &
if they are to survive a disconnected puTTY session.
In summary, if you’re working remotely, and kick off scripts over a remote session that will run for a long time on solaris servers, don’t use bash.
To determine whether your script is still running when you manage to reconnect, use ps -ef | grep myscript.sh