Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to find last use 1

Status
Not open for further replies.

longhair

MIS
Feb 7, 2001
889
US
Hi all,

Not sure if this is possible.
Running HPUX11.
We have many users who forget to sign off when they are not actively using their terminals. I was wondering if it's possible to find the last time a user / login was actively used and if it's more than x minutes generate a mail (would like to kill it but that's not always a nice option).
Any thoughts would be greatly appreciated.

Regards,

longhair
 
Here's an example of the 'w' command. It is a pretty standard command as far as I know.
Code:
$ w
  7:53pm  up 32 days,  3:21,  9 users,  load average: 0.00, 0.08, 0.14
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU  WHAT
spc      :0       -                20Jun03   ?     0.00s   ?     -
spc      pts/0    -                20Jun03 32days  0.00s   ?     -
spc      pts/1    -                15Jul03 42:13   1:02   0.00s  gdb
spc      pts/4    -                Sat 2pm  0.00s  2.30s  0.01s  w
spc      pts/3    -                Thu 3pm 35:36   0.93s  0.10s  /bin/bash
spc      pts/5    -                Sat10pm  2days  0.12s  0.04s  bash
spc      pts/6    -                Mon 7pm 24:23m  0.07s  0.07s  /bin/bash
You can then start to use the login/idle times to determine what to do about it.
 
Put TMOUT=36000 in profile or write a script around finger -i
 
Ygor,

thanks. just what i needed to get started.

regards,

longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top