[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Users not logging off causing server to max out.



On Tue, 2 Dec 2003, John P. Conlon wrote:
> We are using 3.1.2
> We have discovered in our school that when our students just turn th
> epower off on the terminals the server keeps their services open.  Then
> the next day when a new batch of students comes in and logs on many of
> them get an error message that states that the server is full.
>
> Is there a command line that can be entered by a root user at the end of
> the day that will close all users and if there is, what is it?
>
> Can this command line be set up so that it is clock activated sometime
> during the night?
>
Pat,
	no command line, but a script below will do it for you. run it
nightly. details on how in "man crontab". julius

#!/bin/bash
#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
#echo $user

        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





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]