Script to kill all running processes for a user.
Create a new file in /sbin and name it kill4me:
# cd /sbin
# touch kill4me
Using your favorite text editor add the following to kill4me: [download kill4me]
#! /bin/sh
if test $# -lt 1
then
echo "Usage cmd login-id"
exit 0
fi
ps -U $1 | grep -v "PID" | sort -r -o TmPkj0000
awk ' {print $1 } ' TmPkj0000 > kill1
# cut -f2 -d' ' kill1 > kill2
l_str=`paste -s -d"\t\n" kill1`
echo $l_str
kill -9 $l_str
echo
echo "All Processes killed for user" $1
echo "new processes are "
echo
rm -f TmPkj0000
rm -f kill1
ps -u $1 | sort -r
Usage:
# kill4me [username]