Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc05!hpbbn!hpbbi4!eugen From: eugen@hpbbi4.BBN.HP.COM (#Eugen Bauknecht) Newsgroups: comp.unix.admin Subject: Re: Program to log off idle users Message-ID: <9800001@hpbbi4.BBN.HP.COM> Date: 1 Oct 90 09:54:23 GMT References: <10504@hacgate.UUCP> Organization: Hewlett-Packard GmbH Lines: 24 I am using a script which I called " killuser " and which is started by cron every 10 minutes or so. Hope this helps =================================================================== # killuser # kills all users, whose processes are idle longer than 1 hour. who -u | awk '{print $2,$6}' > /tmp/kltmp0 cat /tmp/kltmp0 | awk '{ if ($2>=1) print $1 }' >> /tmp/kltmp1 var=`cat /tmp/kltmp1` ;export var for i in $var do ps -ft $i >> /tmp/kltmp2 done cat /tmp/kltmp2 2>/dev/null| awk '{if ($2 !="PID") print $2}' >>/tmp/kltmp3 sort -rn -o/tmp/kltmp4 /tmp/kltmp3 var=`cat /tmp/kltmp4` kill -9 `echo $var` 2>/dev/null rm /tmp/kltmp* 2>/dev/null #end