Reputation: 6638
I want my program to react on being killed by the 'killall myApplication' command. So that it can save something and then terminate. I know this must be done by signal handling but I am not sure which Singal it gets when being killed.
Upvotes: 0
Views: 345
Reputation: 20718
killall
or killall -9
? Because -9
would mean SIGKILL, which cannot be handled nor masked (your process would be terminated right away in the scheduler, without it having any notion that any signal was sent to it).
Without -9
, it would be SIGTERM, which can be handled. Have a look at man signal
.
Upvotes: 2