I have a requirement to write to a log file on reception of any terminate command like SIGTERM AND SIGKILL.
I can register for SIGTERM but how can handle the SIGKILL signal?
I have a requirement to write to a log file on reception of any terminate command like SIGTERM AND SIGKILL.
I can register for SIGTERM but how can handle the SIGKILL signal?
You cannot, at least not for the process being killed.
What you can do is arrange for the parent process to watch for the child process's death, and act accordingly. Any decent process supervision system, such as daemontools, has such a facility built in.
fghack
program that works on that premise.) –
Asur © 2022 - 2024 — McMap. All rights reserved.
kill -9
unless they absolutely have to. Processes should have a chance to clean things up unless you think they are malicious instead of simply off-the-rails or unwanted. – Tavis