Catching SIGTERM Vs Catching SIGINT
Answer :
The accepted answer is wrong.
- From https://en.wikipedia.org/wiki/Unix_signal
SIGTERM The SIGTERM signal is sent to a process to request its termination... SIGINT is nearly identical to SIGTERM.
- The description around command
kill
is incorrect.
You can catch both of them and still be able to close the process with a SIGKILL - kill -9 pid
That's wrong. Again, from above wiki:
The SIGKILL signal is sent to a process to cause it to terminate immediately (kill). In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal.
So, all in all,
SIGINT is nearly identical to SIGTERM.
From https://en.wikipedia.org/wiki/Unix_signal:
SIGINT
is generated by the user pressing Ctrl+C and is an interrupt
SIGTERM
is a signal that is sent to request the process terminates. The kill command sends a SIGTERM
and it's a terminate
You can catch both SIGTERM
and SIGINT
and you will always be able to close the process with a SIGKILL
or kill -9 [pid]
.
Comments
Post a Comment