finding idle users

I am trying to write a script that will list the idle users on my system which is running HPUX 11.11. The script is currently written as :

who -u > /home/rfm/scripts/user.txt

echo " There are currently... "
wc -l /home/rfm/scripts/user.txt
echo " User logins on System : `uname -n` "

grep "0:" /home/rfm/scripts/user.txt > idle_u.txt
grep "1:" /home/rfm/scripts/user.txt >> idle_u.txt
grep "2:" /home/rfm/scripts/user.txt >> idle_u.txt
sort -u -t ',' -k 1,1 idle_u.txt
wc -l /home/rfm/scripts/idle_u.txt

echo " Users are "IDLE" "
echo " "
echo " "
echo " IDLE User Logins "
echo " ---------------- "
echo " "
cat /home/rfm/scripts/idle_u.txt | pg
echo " "

The other problem is there are multiple logins for the users. I would use this list to determine which users to force to log out. There are at least 800 logins at any given time. I would also be looking at some sort options to determine longest idle to shortest.

Do you know about using the TMOUT environment variable in /etc/profile?

It will handle idle process cleanup problem for you. Set it readonly, and for the number of idle seconds before the process is killed. We use 14400. If you make it too short a duration, users will do something to prevent it from working, like stay in vi all the time.

I am familiar with the " TMOUT " option I have it inserted into the profile and tested it. The option works like a charm :smiley: however; the option is not used " yet " because the powers that be can not decide on a time out limit or a limit for logins. Usually they wait until users can not log in and come to me to free up sessions.