Why doesn't kill work?

Michael Yep myep at remotelink.com
Fri Jan 28 22:41:04 UTC 2005


some other helpful commands
jobs - lists your background jobs
fg #    bring job # to the foreground (so you can hit <ctrl> + C)
ps aux (so you can see if you own the process)


At 08:56 AM 1/28/2005, David Liguori wrote:
>Robert Locke wrote:
>>On Thu, 2005-01-27 at 21:04 -0500, David Liguori wrote:
>>
>>>In another thread a user having problems with yum killed it.  I am 
>>>curious how he accomplished that.  When I run yum (or any other command, 
>>>for that matter), it stalls, and I stop it with ctrl-z, the following happens:
>>
>>First question, why are you stopping it with Ctrl-Z??  Ctrl-Z puts it to
>>sleep into the background.  Why not use Ctrl-C which is the intended
>>approach?
>>
>>>[1]+  Stopped                 yum update
>>>[root at tabby ~]# ps
>>>   PID TTY          TIME CMD
>>>  6179 pts/0    00:00:00 su
>>>  6182 pts/0    00:00:00 bash
>>>  6214 pts/0    00:00:21 yum
>>>  6220 pts/0    00:00:00 ps
>>>[root at tabby ~]# kill 6214
>>>[root at tabby ~]# ps
>>>   PID TTY          TIME CMD
>>>  6179 pts/0    00:00:00 su
>>>  6182 pts/0    00:00:00 bash
>>>  6214 pts/0    00:00:21 yum ##still running!
>>>  6221 pts/0    00:00:00 ps
>>>[root at tabby ~]# exit
>>>logout
>>>There are stopped jobs. ##still running!
>>>[root at tabby ~]#
>>
>>This is working as intended.  You are using the kill command correctly
>>by sending the default signal first (15), the problem is that you put
>>the process to sleep earlier with the Ctrl-Z so it cannot "process" the
>>TERM (15) signal that you have sent.  You could at this point bring the
>>process to the foreground waking it up by using the "fg" command, or you
>>could awaken it in the background using the "bg" command.  Once the
>>process is awake, it will process the signal and go away.
>>BTW, I would not recommend, as many people are wont to do, and jump onto
>>the KILL (9) signal.  If your process is still writing things to disk
>>(asleep or awake), this signal pulls the proverbial rug out from
>>underneath and you run the risk of ending up with corrupted data
>>depending on the process.  Use the KILL (9) signal only as a last
>>resort.
>>I think most books now say this is the proper order:
>>Ctrl-C
>>kill -15
>>kill -9
>>HTH,
>>--Rob
>Thanks for all the help on this.
>
>--
>Dave
>
>--
>fedora-list mailing list
>fedora-list at redhat.com
>To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list

Michael Yep
Development / Technical Operations
RemoteLink, Inc.
(630) 983-0072 x164




More information about the fedora-list mailing list