Can't terminate a nohup process

3

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.

user1812379

Posted 2012-11-13T18:37:46.810

Reputation: 133

1You may want to take this to unix.stackexchange.com – Ali – 2012-11-13T18:40:04.817

I'm pretty sure nohup is not supposed to trap SIGTERM, unless you happen to be using the 4.3 BSD version. Maybe the script itself is ignoring the signal?

– Frédéric Hamidi – 2012-11-13T18:48:24.870

so sigterm is masked as well, check for external executions inside your bash script and find which one is responsible, you may find an alternative solution – None – 2012-11-13T18:50:16.480

If the author of the program made it ignore SIGTERM, surely he will have documented a way to stop it. Perhaps it really does want SIGKILL. Without access to information about this particular program, we can only guess. – tripleee – 2012-11-13T18:53:26.417

Did you try SIGQUIT (before SIGKILL)? – Basile Starynkevitch – 2012-11-13T19:17:48.893

Answers

2

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.

Sahas

Posted 2012-11-13T18:37:46.810

Reputation: 172