kill may be a slightly painful name for the command, but it is what it does.
What some people don't know is that there are several "levels" of kill
commands.
The proper command is actually kill <level> <pid> where there are 44
different levels, although only a few are used.
$ kill -l
1) HUP 16) USR1 31) RESERVED
2) INT 17) USR2 32) DIL
3) QUIT 18) CHLD 33) XCPU
4) ILL 19) PWR 34) XFSZ
5) TRAP 20) VTALRM 35) bad trap
6) IOT 21) PROF 36) bad trap
7) EMT 22) POLL 37) RTMIN
8) FPE 23) WINCH 38) RTMIN+1
9) KILL 24) STOP 39) RTMIN+2
10) BUS 25) TSTP 40) RTMIN+3
11) SEGV 26) CONT 41) RTMAX-3
12) SYS 27) TTIN 42) RTMAX-2
13) PIPE 28) TTOU 43) RTMAX-1
14) ALRM 29) URG 44) RTMAX
15) TERM 30) LOST
Of these only a few are commonly used. kill -15 is used as sort of a "Would
you please shutdown?" message to a process, while kill -9 says more of "I
don't care what you are doing, die now!!". In the grand scheme of things,
one may not appear to be different than another, but the 15 allows the
process a chance to trap the kill, and gracefully shutdown, the 9 doesn't.
The process is blown out of the water - which can cause some really bad
problems if I/O isn't completed, semaphores aren't released, etc. The other
kills (which, btw, can be used either by number, or their equivalent names),
do various things. One (and I think it's 6, but I'm not sure) forces a core
dump to be produced for debugging purposes.
-------------------------------------------------------------
Gary L. Paveza, Jr.
Technical Services Manager
(302) 761-3173 - voice
(877) 720-2970 - pager
-----Original Message-----
From: Donna Garverick [SMTP:[log in to unmask]]
Sent: Tuesday, December 05, 2000 1:52 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] PX2LXD4(A)
several people have asked:
> What is ps?
oh...well....ok.... i'd compare ps to showjob. our unix
brethern do something like 'ps -ef|grep <blahblahblah>' when
looking for certain background process (jobs) or users. this
is a sample of output from ps:
:ps -a
PID TTY TIME COMMAND
1 0:37 PROGEN.PUB.SYS
65538 10:03 LOAD.PUB.SYS
65539 35:00
65540 0:26
in mark bixby's presentation at hpworld on web wise, while
talking about stopping secure apache (and regular ol' apache
too), he mentioned that it is *highly* desireable to use 'kill'
instead of abortjob. using abortjob will cause leaky
semaphores (yuck! ...and their sticky and smelly too... :-).
using 'kill', i've come to understand, applies to all (is that
right, mark?) these wonderful new posix background 'things' on
our systems. things include: syslog, sendmail, bind,
samba.... i guess most of these s/w packages 'know' what to do
when they're killed (btw, could they have picked a worse name
for this command?). that is, they do a 'gracefullish'
shutdown. to them, abortjob is like a big, heavy sledge
hammer. so...what does this have to do with ps?
kill needs a 'pid' (a process id) to do it's thing. how do you
get a pid? by using ps. (ohhh, ahhh :-). the problem is, ps
(on 6.0) was compiled without 'ba' capability -- makes it kinda
hard to write a *job* to halt posix jobs....
btw, since mark is busy (:-) i'll add that for apache in
particular, the designers had the sense to write the pid out to
a file (duh), so you don't have to figure it out. my httpstop
job (which has all of 3 lines in it :-) has the following
command:
!xeq sh.hpbin.sys "-c 'kill `cat logs/httpd.pid`'"
(it's an exercise for the reader to figure out the other 2
lines :-) hth - d
--
Donna Garverick Sr. System Programmer
925-210-6631 [log in to unmask]
"Unix _is_ user friendly.
It's just very selective about who its friends are.
And sometimes even best friends have fights."
>>>MY opinions, not Longs Drug Stores'<<<
|