Is it possible to let a program itself capture a Kill Signal, write a log, then exit?
Say, a program is called myprog. you use
to kill it in linux.Code:killall myprog
Instead of exiting immediately, myprog writes a log about someone is killing it, and then it exits? Is there a such way?