[CALUG] how to kill a process tree in PS

Tim Spangler tspang at jefnet.com
Mon Oct 30 15:19:24 EDT 2017


Unless centOS does something I don't know about, I imagine the easiest way would be to ps -ef and grep for the parent pid, then pipe it to awk and use xargs to kill all the processes.  If the parent process is already dead, the parent process should revent to 1, in which case you'd need to grep for a string in your process, like kppp"

Ex:

ps -ef | grep <PARENT PID> | grep -v grep | awk '{print $2}' | xargs kill

ps -ef | grep -v grep | grep kppp | awk '{print $2}' | xargs kill

-----Original Message-----
From: CALUG [mailto:calug-bounces at unknownlamer.org] On Behalf Of Walt Smith
Sent: Friday, October 27, 2017 11:58 AM
To: calug <calug at unknownlamer.org>
Subject: [CALUG] how to kill a process tree in PS


hi,

I have a kppp kde dialer in CentOS6.8
( which generally works better than CentOS 7.x ) (I installed the x32 software hard disk into a x64 box ).

Its the gui dialer.
However, due to the way it's no longer integrated nicely,  I need to keep a su terminal open to start or stop  the kppp/pppd processes.

The question is this:
how can I kill a tree of processes?  I find the man page simply comfusing.

example:

I'd like to kill all of the following in the tree, without listing each process in the cli kill. 
IOW kill the "root" - 6484


[root at CentOS68 waltech]# ps axf | grep ppp
 6484 ?        Sl     0:00 kppp
 6486 ?        S      0:00  \_ /usr/sbin/userhelper -w kppp
 6494 ?        S      0:32      \_ kppp
 6495 ?        Ss     0:00          \_ kppp
 6510 ttyS0    Ss+    0:00              \_ pppd 115200 -detach defaultroute persist modem mtu 552 mru 552 holdoff 0 debug nolock chap-restart 3 noauth refuse-mschap refuse-mschap-v2 refuse-eap chap-interval 30 chap-max-challenge 1000 pap-max-authreq 1000 lcp-echo-interval 10 lcp-max-configure 100 lcp-echo-failure 10 nomagic pap-timeout 5 user waltech at tenex.org


thanks
Walt . . . 


----
 The government is lawless, not the press (people).
 ( [Supreme Court] Justice Douglas re: The Pentagon Papers )

_______________________________________________
CALUG mailing list
CALUG at unknownlamer.org
http://lists.unknownlamer.org/listinfo/calug




More information about the CALUG mailing list