|
|
| Boulware5 2002-06-13, 10:47 pm |
| I'm practicing trapping Unix signals on my Linux machine and it doesn't work for some reason. You should be able to instruct your process to ignore interrupt signals and/or display a message or command. For instance if I do:
$ trap "echo I won't die" 9
$ man trap #Run any process
^Z
$ ps x
$ kill -9 PID
$ ps x
...And it went away. It was supposed to display 'I wont die' and still stay there until I resetted it by issuing a $ trap 9 command. Same thing happens when I $ trap "" 9 (no command).
Any ideas? | |
| The VMS Kid 2002-06-14, 7:06 am |
| The "9" signal only traps kills (cannot be caught or ignore). Try another signal. The list of the most common I think is like this:
0 - shell exit for any reason, including end of file
1 - hangup
2 - interrupt (DEL key)
3 - quit (CTRL-\; causes program to produce core dump)
9 - kill (cannot be caught or ignore)
15 - terminate, default signal generated by kill(1)
Hope this helps. | |
| Boulware5 2002-06-14, 11:02 am |
| I am pretty sure I did and still didn't work. I did signal 15 (the default). You should be able to trap that. | |
| The VMS Kid 2002-06-24, 1:23 pm |
| Hmmm, I'm not sure. Will have to look at some of the docs and see if I can come up with anything. |
|
|
|