I would like to send a SIGTERM signal to a nohup process, but this signal is completely ignored, only SIGKILL works, which is considered a bad choice to terminate a shell script. Do I have any options here or do I have to stick to SIGKILL? Thanks in advance.
migrated from stackoverflow.com Nov 14 '12 at 13:39
This question came from our site for professional and enthusiast programmers.
I'm sure nohup traps only SIGHUP and not SIGTERM.
If I remember correctly, bash ignores all SIGTERM and SIGQUIT signals sent to it, unless traps have been setup. Look here to findout how to setup traps in your script: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_12_02.html
You can verify it this is the problem by first starting your script without nohup, then send a SIGTERM to it and see if it is ignored.