On Mon, 2004-05-17 at 10:04, Louis Richards wrote:
Pieter Hulshoff wrote:
Sometimes killing the root process (normaly /bin/bash) will still leave running processes.
This is not very complete, however, it should work. Name it somthing like 'killuser' and run 'killuser username'. NOTE: This is mean ... unforgiving ... and sometimes fun (I did this to my wife ... just as she was about to win her card game ... ONCE ;-) ).
#!/bin/bash echo echo "----------------------------------------------" echo Killing all processes owned by user $1 echo "----------------------------------------------" kill -9 `ps -u $1 -o "pid="`
kill -9 is rather extreme isn't it. Try kill -1 first for a more graceful logout of the process and a better chance of the child processes being killed as well.
echo "----------------------------------------------" echo There are `ps -u $1 -o "pid=" | grep -c ""` processes left for user $1 echo "----------------------------------------------" echo
-- Ken Schneider unix user since 1989 linux user since 1994 SuSE user since 1998 (5.2)