PDA

View Full Version : Kill all processes by user



l0rdphi1
09-14-2003, 01:19 PM
I have a user who keeps running CGI scripts that never fully remove themselves from the processes list. He has 90 some proceeses on there now.

Anyway, shouldn't the following kill all processes for {user}:

kill `ps -aux | grep {user} | awk '{print $2}'`

It's not working :mad:

Thanks,
Phi1.

l0rdphi1
09-14-2003, 01:32 PM
I got a step farther with the following:
[root@server1 root]# ps -aux | grep {user} | awk '{print "kill",$2}' | sh
sh: line 12: kill: (7217) - No such process

DirectAdmin Support
09-14-2003, 04:27 PM
Hello,

The kill program defaults to use the TERM signal... which is a way of nicely asking the program to leave... what you want is KILL!!! :D ... or "9" so.. you would use:

kill -9 `ps -aux | grep {user} | awk '{print $2}'`

John

l0rdphi1
09-14-2003, 05:08 PM
Thanks. kill -9 seemed to work.