Re: Why doesn't kill work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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@tabby ~]# kill 6214
[root@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@tabby ~]# exit
logout
There are stopped jobs. ##still running!
[root@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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux