why won't this script work in my Edubuntu setup?
mariodebian
mariodebian at gmail.com
Thu Aug 30 13:33:02 BST 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
digitalmente
Url : https://lists.ubuntu.com/archives/edubuntu-users/attachments/20070830/b4f1b0f5/attachment.pgp
More information about the edubuntu-users
mailing list