Operating System - HP-UX
1754334 Members
2703 Online
108813 Solutions
New Discussion юеВ

last login displayed in numbers

 
Mark Cafferkey
Occasional Advisor

last login displayed in numbers

Hi,
I am running HPUX 11 and am writing a script to delete users - one of the checks I would like to do is to ensure the user has not logged on in over 14 days. Without using Perl, does anyone have a simple method.
Thanks
Mark
5 REPLIES 5
Alex Glennie
Honored Contributor

Re: last login displayed in numbers

check out the man page for the last command may help ?
Alex Glennie
Honored Contributor

Re: last login displayed in numbers

ps appologies if your already using last to get the details.... I'm still looking for some more useful details ....
James R. Ferguson
Acclaimed Contributor

Re: last login displayed in numbers

Hi Mark:

You might consider using:

# last -1

where is substituted from reading /etc/passwd (obviously).

The 'last' will return the single most recent logon (if any) for the user. You could convert the date in month-name and day format to a simple numeric value representing the day-offset of the current year and compare for an equal or greater than 14-day difference.

...JRF...
Michael Tully
Honored Contributor

Re: last login displayed in numbers

Hi Mark,

One thing to note is to make sure that
when you write your script check to
make sure that your /var/adm/wtmp file
carries the information for the full
14 days.

Michael
Anyone for a Mutiny ?
Mark Cafferkey
Occasional Advisor

Re: last login displayed in numbers

Thanks All for the replies,
James - I got as far as the last -1 but thought there might be a simpler way to obtain a number value rather than write a small script to convert. No problem
Thanks for the help
-M