LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 09-18-2005, 12:30 PM   #1
Racy
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Rep: Reputation: 0
Killing a process fails. Have tried all I know.


I started cvs to update the mozilla source tree when cvs hanged. I tried to kill the process by using kill and kill -9 but that failed. I also tried to kill the parent bash shell and that worked but the cvs process was still there.

I have tried all I know to kill the process including kill, kill -9 and killall -9 cvs. Any help is appreciated.
 
Old 09-18-2005, 12:36 PM   #2
dinolinux
Member
 
Registered: Jun 2005
Location: Oslo, Norway
Distribution: Slackware 11, Solaris 10, Solaris 9, Sourcemage 0.9.6
Posts: 322

Rep: Reputation: 31
Have you tried Ctrl-C
 
Old 09-18-2005, 01:32 PM   #3
Racy
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by dinolinux
Have you tried Ctrl-C
Of course I have Thats the first thing I did. ctrl-c ctrl-z and so on. After that failed I started using kill.
 
Old 09-18-2005, 01:34 PM   #4
Elbryan
Member
 
Registered: Feb 2005
Distribution: Gentoo
Posts: 59

Rep: Reputation: 15
try the button on the pc named reset :look:
 
Old 09-18-2005, 01:40 PM   #5
ech310n
Member
 
Registered: Jan 2004
Distribution: RHEL, Fedora
Posts: 46

Rep: Reputation: 16
You have an orphaned zombie process. You could try silver bullets on it, but failing that the only way is a good old fashioned reboot :-(
 
Old 09-18-2005, 01:43 PM   #6
Racy
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by ech310n
You have an orphaned zombie process. You could try silver bullets on it, but failing that the only way is a good old fashioned reboot :-(
How annoying Reminds me of good old fashioned win98 where you had to reboot every day.
 
Old 09-18-2005, 01:57 PM   #7
ech310n
Member
 
Registered: Jan 2004
Distribution: RHEL, Fedora
Posts: 46

Rep: Reputation: 16
Very true...and besides that "Rebooting is a sign of weakness"....but sometimes it has to be done. Sad but true.

In future though, it might be worth doing this...

Gradually increase the strength of your kill signals rather than going in there with the sledge hammer straight away i.e. go for kill, -3, -1, -11 (beware this will often produce a core dump), -5 and then if all that fails go for the -9. You should make sure the process is given an adequate amount of time to exit and clear up after itself before wading in with the old -9 though.

It is actually a nice idea to write a bit of a wrapper script to an alias kill to it instead of using /usr/bin/kill just to automate the process a bit. Something like this might do the trick...

#!/bin/bash

if [ $1 = "-9" ]
then
echo "Kill signal of -9 is not acceptable. Overriding."
shift
fi

for PID in $*
do
PROCESS=`ps -fp$PID | grep -v STIME`
USERID=`echo $PROCESS | awk '{print $1}'`
PROCNAME=`echo $PROCESS | awk '{print $8}'`

LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt 0 ]
then
echo "Killing process $PID $PROCNAME for $USERID with default signal."
/bin/kill -15 $PID
sleep 2
LIVE=0
fi
LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt 0 ]
then
echo "Process still alive. Upping kill signal to -3"
/bin/kill -3 $PID
sleep 2
LIVE=0
fi
LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt "0" ]
then
echo "Process still alive. Upping kill signal to -1"
/bin/kill -1 $PID
sleep 2
LIVE=0
fi
LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt "0" ]
then
echo "Process still alive. Upping kill signal to -11"
/bin/kill -11 $PID
sleep 2
LIVE=0
fi
LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt "0" ]
then
echo "Process still alive. Upping kill signal to -5"
/bin/kill -5 $PID
sleep 2
LIVE=0
fi
LIVE=`ps -fp$PID | grep -c -v STIME`
if [ $LIVE -gt "0" ]
then
echo "Unable to kill process."
LIVE=0
fi
echo ""
done
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Process killing script owix Linux - General 2 07-19-2005 12:08 PM
Killing process by username mijohnst Linux - Software 4 05-30-2005 09:50 PM
Killing a process by its name rabeea Linux - Networking 3 03-17-2005 06:30 AM
Killing Process probs collen Linux - General 4 09-16-2003 10:18 AM
Really Killing a Process! lazlow69 Linux - Newbie 14 05-10-2003 11:31 PM


All times are GMT -5. The time now is 01:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration