Is there a way to get a callback/signal after killing a linux process with kill/pkill command?
Asked
Active
Viewed 537 times
0
-
Who/what needs to receive the callback/signal? – kaylum Jan 05 '17 at 05:31
-
Same process, which called 'kill' to take further action. – Shailesh Jan 05 '17 at 05:37
-
But what is this "process"? Is it a c program? A shell script? What? A C program can use [`waitpid`](https://linux.die.net/man/2/waitpid) to wait for the process to exit. – kaylum Jan 05 '17 at 05:42
-
It's a shell script. – Shailesh Jan 05 '17 at 07:14
-
No. You can use `wait $pid` - it will return when the process with $pid is terminated. Or some sort of mechanism using available commands _(pgrep)_ to make sure that the process is killed and you can continue further. – SD. Jan 12 '17 at 10:21
-
As much I know, `wait $pid` only waits for child processes. I'm killing a process with a specific PID, which was started from some other program. and then trying to get something to be sure that killing of process(PID) has been successful. – Shailesh Jan 12 '17 at 14:19