When I execute the following:
su - deployer -c "ls; sleep 250"
It outputs the ls
and then sleeps for a few minutes. If I hit Ctrl+C, I get this output:
Session terminated, terminating shell... ...killed.
But then, this happens and I do not expect it:
root@machine:# ps ax|grep slee
29918 ? S 0:00 sleep 250
That is, the sleep
process is still running, even though its parent process was terminated.
How can I structure this such that the parent process' death also results in this sleep process' death?
This is causing me grief because I have a similar setup, but cannot get my daemontools or upstart scripts to reliably bring the process down.