kdavis@lamc.UUCP (Ken Davis) (05/19/89)
Info-3b2 Digest, Number 84 Friday, May 19th 1989 Today's Topics: idledaemon ---------------------------------------------------------------------- Subject: idledaemon From: info-3b2@netsys.COM Date: Fri, 19 May 89 00:56:16 -0400 Date: Thu, 18 May 89 11:19 CDT From: sysop@killer.Dallas.TX.US (Charles Boykin-BBS Admin) Len, Here is one - it can be modified to suit. It does work well. Charlie ------------------------- # idletime.sh - Idle job kill demon # will kill all jobs idle longer than 15 minutes # mail a message to the offender and log this # deed into /etc/idle.log umask 077 set `who -u | awk '{print $1,$2,$3,$4,$5,$6,$7}'` while true do name=$1 linetty=$2 month=$3 day=$4 logtime=$5 idle=$6 pid=$7 if [ $idle != "." ] then if [ `echo $idle | cut -c3-4` -gt 15 ] then echo $name $linetty $month $day $logtime $idle $pid >> /etc/idle.log mail $name <<EOF You have been found guilty of a UNIX Misdemeanor! Count One: HOGGING Resources by leaving your terminal logged in for a long period of time. (Over 15 minutes of inactivity) Count Two: Leaving the system exposed for others to peek at things that they have no business looking at. (WE Don't need Sight Seeing lurkers perusing though TOP SECRET Documents, and doing other unauthorized activities.) Therefore: You will be taken to the UNIX Jail, at which time there will be great gnashing of teeth. System Administrator Msg-90/idle EOF kill -9 $pid fi fi shift; shift; shift; shift; shift; shift; shift if [ $# -lt 7 ] then exit 0 fi done # EOF ------------------------------------- To join this group or have your thoughts in the next issue, please send electronic mail to Ken Davis at the following address; {apple, netsys, pacbell, pyramid}!lamc!info-3b2-digest The views expressed in Info-3b2 Digest are those of the individual authors only. ********************** End of Info-3b2 Digest **********************