stummj
asked on
Kill a process
I have done ps-ef and found a particular process I need to kill.
gsmprodn 16476 9527 0 14:57:06 pts/1 0:00 grep wrapper.sh
How do I know which is the parent PID and which is the child, and which one should I kill?
gsmprodn 16476 9527 0 14:57:06 pts/1 0:00 grep wrapper.sh
How do I know which is the parent PID and which is the child, and which one should I kill?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes - that has sorted it
In the PS -ef output the seconnd column is the pid (process ID) and third column is ppid (parent process ID). You can see the headers too with this command:
ps -aef | egrep -E "^U|wrapper.sh" | grep -v grep
Will show you columns with the heading.
If you want to do a kill then you would use the command:
ps -aef | grep wrapper.sh | grep -v grep | xargs kill -9 $(awk '{ print $3 }')
to kill tehe parent while
ps -aef | grep wrapper.sh | grep -v grep | xargs kill -9 $(awk '{ print $2 }')
Will kill the process (in this case wrapper.sh).
Cheers,
K.
ps -aef | egrep -E "^U|wrapper.sh" | grep -v grep
Will show you columns with the heading.
If you want to do a kill then you would use the command:
ps -aef | grep wrapper.sh | grep -v grep | xargs kill -9 $(awk '{ print $3 }')
to kill tehe parent while
ps -aef | grep wrapper.sh | grep -v grep | xargs kill -9 $(awk '{ print $2 }')
Will kill the process (in this case wrapper.sh).
Cheers,
K.
ASKER
And I know its running as there are files being produced. I guess its the processes inside the wrapper I need to look for