Kill Usage
kill -HUP PID
kill -TERM PID
kill -KILL PID
(I did not write this, I just found it and posted it here for my own reference.)
Why does everyone jump straight to -9?
DO NOT USE -9 AS YOUR FIRST KILL SIGNAL.
Try a nice friendly -HUP … perhaps a little stronger -TERM.
If, for some reason, these don’t work, knock a little louder with -KILL (ie: -9), but don’t whine if something else gets hosed due to the strong signal (not to scare anyone, it’s unlikely that anything critical is happening anyway, any more than just writing a file– but you could leave resources locked/in use (ie: memory, etc)).
Also, use -HUP and -TERM and -KILL …. you’ll be thankful when you miss your kill -1 and do a kill 1 instead … you’ll use -HUP from then on (well, maybe not on a pda, but on a production server etc.)
UNIX kill signals
|
Signal |
Signal |
Action |
|
HUP |
1 |
Hangup |
|
INT |
2 |
Interrupt |
|
QUIT |
3 |
Quit (dumps core file) |
|
ILL |
4 |
Illegal instruction (dumps core file) |
|
TRAP |
5 |
Breakpoint trap (dumps core file) |
|
IOT |
6 |
I/O trap (dumps core file) |
|
EMT |
7 |
Emulator trap (dumps core file) |
|
FPE |
8 |
Floating Point Exception (dumps core file) |
|
KILL |
9 |
Kill with extreme prejudice |
|
BUS |
10 |
Bus error (dumps core file) |
|
SEGV |
11 |
Segment Violation (dumps core file) |
|
SYS |
12 |
Bad system call argument (dumps core file) |
|
PIPE |
13 |
Write to nonexistent pipe |
|
ALRM |
14 |
Alarm clock timeout |
|
TERM |
15 |
Terminate |
|
USR1 |
16 |
User defined signal |
|
USR2 |
17 |
User defined signal |
|
CHLD |
18 |
Child status (aka CLD) |
|
PWR |
19 |
Power failure or restart |
|
WINCH |
20 |
Window size change |
|
URG |
21 |
Urgent socket condition |
|
IO |
22 |
Socket I/O (aka POLL) |
|
STOP |
23 |
Stop from non-tty process (see CONT) |
|
TSTP |
24 |
Stop from tty process (see CONT) |
|
CONT |
25 |
Continue a stopped process |
|
TTIN |
26 |
Waiting for background tty input (see CONT) |
|
TTOU |
27 |
Waiting for background tty output (see CONT) |
|
VTALRM |
28 |
Virtual alarm timeout |
|
PROF |
29 |
Profiling timeout |
|
XCPU |
30 |
CPU time limit exceeded (dumps core file) |
|
XFSZ |
31 |
File size limit exceeded (dumps core file) |
