glk
I was thinking of doing what you want to and kill them off, after carrying out the following and letting users no their idle time we soon educated them..
#!/bin/sh
#Program name:idleuser.sh
#Date created:March 2002
# Script to monitor system usage and idle time of users. #All users 45 minutes plus idle will be logged, any one #idle for 1 hour plus and depot managers and IT will #recieve an email
#Declare Variables
set -x
FATALMAIL="manager@myfirm.com, itdept@myfirm.com"
TODAY=`date +"%d/%m/%y at %T"`
LOGFILE=/u/shared/logs/usersidle.log
DEPOT=`uname -n`
echo "Report run on $TODAY.">> $LOGFILE
#filter users for selected conditions
finger -i | awk '/hour/ && $7 > 0 { print $1 ; }' > /dev/null 2>&1
if [ $? != 0 ]
then
finger -i | awk '/minutes/ && $7 > 45 { print $1 ; }' > /dev/null 2>&1
if [ $? != 0 ]
then
echo "There were no users with idle time in excess of 45 minutes
***-----------------------------------------------------***" >> $LOGFILE
fi
else
echo "The following users have been found idle:
User Idle time Process
----- --------- ---------------" >> $LOGFILE
#Log all 45+ minutes idle
finger -i | awk '/minutes/ && $7 > 45 { print $1 ; }' | while read USERS
do
w -h $USERS | awk '! /root/ {printf ("%-32s %-14s %-32s\n", $1,$4,$7); }' >> $LOGFILE
done
#Email raised warning of excessive idle time.
finger -i | awk '/hour/ && $7 > 0 { print $1 ; }' | while read USERS
do
w -h $USERS | awk '! /root/ {printf ("%-32s %-14s %-32s\n", $1,$4,$7); }' >> $LOGFILE
mail -s "User Idle Problem" $FATALMAIL <<-END
$USERS has been idle for 1 hr plus on $DEPOT.
Please note that future users with excessive idle time will
have their accounts locked.
END
done
fi
exit