[K12OSN] Kill all your users

Petre Scheie petre at maltzen.net
Mon Dec 11 21:14:08 UTC 2006


Where are you placing the pkill command to execute on logout?

cliebow at midmaine.com wrote:
> we just pkill on logout..seems to minimize the "password sharing" between
> students quite effectively..
>> (in a no n-sadistic manner)  ;-)
>>
>> Kill 'em all!  (at the end of the day)  ;-)
>>
>> Here's how I do it.  I have a script called "stop" located in /usr/bin.
>> It's designed originally to "kill" a single user, but I have taken that
>> script and made another script that can be launched as a cron job to
>> "purge" the server.  First the "stop" script....
>>
>> #!/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
>>
>>
>> Now the script to "stop" them all:
>>
>> #!/bin/bash
>> for x in `ls /home`; do
>> echo "Killing $x ..."
>> stop ${x}
>> done
>>
>> I called this one "stop-all", made it executable (chmod a+x stop-all) and
>> put it into a cron job.  Works pretty slick!  :-)  YMMV
>>
>> PS....doesn't matter if /home is local or mounted via NFS (like
>> Samba/LDAP) it simply reads the directory listing of /home to get
>> usernames.  If your home dirs are in a different location or separated by
>> YOG or something like that....just add the extra step to call that
>> directory.  Something like:
>>
>> for x in `ls /home/2007`; do
>>
>>
>> David N. Trask
>> Technology Teacher/Director
>> Vassalboro Community School
>> dtrask at vcsvikings.org
>> (207)923-3100
>>
>>
>> _______________________________________________
>> K12OSN mailing list
>> K12OSN at redhat.com
>> https://www.redhat.com/mailman/listinfo/k12osn
>> For more info see <http://www.k12os.org>
>>
> 
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
> 




More information about the K12OSN mailing list