[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 Wed, 3 Dec 2003, Darryl L. Palmer, Jr. wrote:

> Neat script.  Am I mistaken or do you have to run this script after the
> date changes on your system.  For example, running it at 23:00 (11PM)
                                                        ^^^^^^^^^^^^^^^
i run it at 1:30am, when there are no users on the system. if you expect
people to use the server 24h, add a tweak to look for process start time


> system time Tuesday will delete only the processes that have a date of
> Monday or earlier because these will be in the Month-Day format.
>
> Darryl
>
> Julius Szelagiewicz said:
> > 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
>
>
> _______________________________________________
> K12OSN mailing list
> K12OSN redhat com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
>




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