Operating System - Linux
1820614 Members
1938 Online
109626 Solutions
New Discussion юеВ

Re: cataching SIGKILL using trap

 
SOLVED
Go to solution
itai weisman
Super Advisor

cataching SIGKILL using trap

hi everyone,
I'm trying to catch a '9' signal using the following command -
trap "Clean ; Killed " 1 3 4 5 9 15 INT QUIT TSTP KILL
on a regular simple bourne shell script,
but it wouldn't catched...
is it possible to catch KILL signal by trap command?
5 REPLIES 5
Alex Lavrov.
Honored Contributor
Solution

Re: cataching SIGKILL using trap

It's impossible.

SIGKILL cannot be trapped, otherwise it loses it's purpose to kill things.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
A. Clay Stephenson
Acclaimed Contributor

Re: cataching SIGKILL using trap

Get used to disappointed. If you do a man 2 signal (the underlying mechanism for traps), you will find that SIGKILL can neither be caught or ignored.
If it ain't broke, I can fix that.
Torsten.
Acclaimed Contributor

Re: cataching SIGKILL using trap

You may perhaps ignore a red traffic light, but your processes will never ignore a SIGKILL.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
itai weisman
Super Advisor

Re: cataching SIGKILL using trap

thanks
Alex Lavrov.
Honored Contributor

Re: cataching SIGKILL using trap

Assiging points to the people that helped you, can be a very nice gesture .....

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)