#!/usr/local/bin/ksh # # Script to kill off all of a user's processes # This script only works on systems with a GNUish ps, and maybe only on # Linux systems since we used some advanced options. # # last modified on September 12, 2000 # by Chris Lumens PS=$(which ps) AWK=$(which awk) GREP=$(which grep) KILL=$(which kill) if [[ "$1" == "" ]]; then echo "usage: killuser username [signal]" exit fi # use signal 15 as default if one is not given signal=${2:-15} for pid in $($PS -U $1 -o pid --no-headers) do # make sure the process is still around if [[ $($PS -p $pid --no-headers) != "" ]]; then $KILL -$signal $pid fi done