Logging the ^d logoff

Peter J. Holsberg pjh at mccc.UUCP
Fri Feb 12 08:06:04 AEST 1988


A while ago, I expressed interest in a method of creating a file of 
user logins/outs.  Many people made many helpful suggestions, but
I find myself without a solution.

One suggestion, which came very close, was to trap 0 1 3 with a line in
/etc/profile so that on ^d logout (or hangup, etc.) a line with "who am
i" information would be written to /usr/.logins.  I found that this
worked quite well except for one thing:  despite the fact that the login
time is accurate, the logout time is always about one second after the
login time, regardless of the actual logout!

So, how can I make "who am i", imbedded in a 'trap' statement execute at
the instant of the trap, rather than when /etc/profile is first
executed?  Many thanks for your help.

-- 
Peter Holsberg                  UUCP: {rutgers!}princeton!mccc!pjh
Technology Division             CompuServe: 70240,334
Mercer College                  GEnie: PJHOLSBERG
Trenton, NJ 08690               Voice: 1-609-586-4800



More information about the Comp.unix.questions mailing list