Looking at your script, I think I can suggest a simpler version
(requires the slay program - just do an FM search, which kills off all
processes for a certain user name);

#!/bin/sh
#This script will kill all processes started by normal users. It should
#be run from cron daily at midnight. The script does not:
#Affect root or system users (such as appache). 
#By using home directories as refferences, we can rule out a system user
#that was accidently misnumbered.

cd /home
for I in *;do slay $I;done

#end of script.


> 
> Well, F. and Jim, GDM doesn't always clear the sessions gracefully, but
> KDM has other "interesting" problems. Here is a qickie solution to what
> ails F. - run the following from cron every night and you won't have to
> call the doctor in the morning ;-)
> 
> #kill old leftover processes  - all of them
> 
> users=$(awk -F":" '{if ( $3 >= 500 ) print $1}' /etc/passwd | grep -v -e
> smb -e ^nfs )
> 
> for user in $users
> do
> 
>         processes=$(ps -ef | grep ^"$user " | grep -e Jan[0-9] -e Feb[0-9]
> -e Mar[0-9] -e Apr[0-9] -e May[0-9] -e Jun[0-9] -e Jul[0-9] -e Aug[0-9] -e
> Sep[0-9] -e Oct[0-9] -e Nov[0-9] -e Dec[0-9] |awk '{print $2}')
> 
>         for process in $processes
>         do
>                 kill -9 $process
>         done
> 
> done
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
> same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
> _____________________________________________________________________
> Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
>       https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
> For additional LTSP help,   try #ltsp channel on irc.freenode.net



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to