El mié, 29-08-2007 a las 18:06 -0400, David Trask escribió:
> I had this script (below) which I used to use to "kill" users quickly....I
> even used to build other scripts from this one....such as one that logged
> off my kindergarten class...etc.  Problem is....it doesn't work in my
> current Edubuntu situation (with smbldap).  any idea why?  What am I
> missing?  I have the script in /usr/bin and the usage is
> 
> stop username 
> 
> used to work fine, but I know I'm missing something with Edubuntu.  Here's
> the script....(commented to avoid messing with your system)  any ideas to
> modify?
> 
> #   #!/bin/sh
> #   # usage  stop username
> #   # stop
> #   # script to logoff a student
> #   #
> 
> #   if [ $1 != "root" ]
> #   then
> #   for i in $(pgrep -u $1)
> #   do
> #      kill -9 $i
> #   done
> # else
> #    clear
> #    echo "Can't kill the root!!"
> #  fi
> 
> 

Try this:

#!/bin/bash

if [ "$1" = "root" ]; then
   echo "Can't kill root"
   exit
fi

pkill -9 -u "$1"
========================


"pkill -u" kills all process of username (see man pkill)

Greetings

-- 
http://soleup.eup.uva.es/mariodebian

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

-- 
edubuntu-users mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/edubuntu-users

Reply via email to