View Single Post

   
  #8 (permalink)  
Old 01-04-2008, 07:55 PM
theycallmetim
 
Posts: n/a
Default Re: Auto Kill Idle Sessions

Kills all users idle more that 45 minutes. Run it in cron.

my=`/usr/bin/who -u|/usr/bin/grep -v nppp|/usr/bin/awk '{ if($6>"0:45") print($
7)}'`
if [ "$my" ]
then
kill -1 $my >/dev/null 2>&1
sleep 10
my=`/usr/bin/who -u|/usr/bin/awk '{ if($6>"0:45") print($7)}'`
if [ "$my" ]
then
kill -9 $my >/dev/null 2>&1
fi
fi
Reply With Quote