this post was submitted on 25 Dec 2024
361 points (99.2% liked)
Programmer Humor
19821 readers
2 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
When I run the script myself and kill it, it gets the signal and acts correctly. Only when I poweroff the system, this doesn’t work.
SIGINT is sent when you press Ctrl+C. SIGTERM is sent in just about every other situation - basically when the system wants the program to end. For instance when systemd wants to stop the service or the default signal with programs like
kill
pkill
htop
etc. You should catch both of these signals.I did try to catch all of these signals:
Good luck trapping the SIGKILL signal