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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi 2 everyone.. i need some assista

Status
Not open for further replies.

jrb23

MIS
Jan 5, 2004
28
0
0
AU
Hi 2 everyone.. i need some assistance on reporting AIX user that have not logged for previous 3 months.
I happen to have more than 5000 entries on the passwd file.
I am devising a script that will interrogate the /etc/passwd(to get all the first column of the passwd file) then relate it to the /var/adm/wtmp using the last command.
Any script that has been posted on this topic will be much appreciated.
Or any other ways of doing it?

Thank you in advance
 
Use that to get the fisrt collumn of /etc/passwd:

more /etc/passwd | cut -d ':' -f 1
 
it is not tested - have no access to AIX now - should check last output column/fields

for i in `awk -F\: '{print $1}' /etc/passwd`;do [ `last $i|head -1|awk '{print $4" "$5}'` = "Jan 21" ] && echo $i last logged on Jan 21;done

or

for i in `awk -F\: '{print $1}' /etc/passwd`;do [ x$(last $i|head -1|awk '{print $4" "$5}') = x"Jan 21" ] && echo $i last logged on Jan 21;done
 
Woooops i read a little bit to fast.

Sorry for my poor answer :eek:)
 
it looks much complex.

do the following:

1. last > last.output
2. vi last.output
(find first line containing "22 Jan" and press "Esc-d-G" , save and exit)

3. Use this to determine which user was not logged within last 3 months:

for i in `awk -F\: '{print $1}' /etc/passwd`;do [ `grep -w -c ^$i last.output` -eq 0 ] && echo $i not logged more then 3 months;done
 
No way, the

lsuser -a time_last_login ALL

command is by far the easiest. It will give you the time in julian date.

 
Thank you -- much appreciated guys..
ogniemi - even not tested but good source that i can modify
Gloups - have not thought bout using last as output to interrogate - might be a good try..
theycallmetim - good idea i will surely explore this

once i have completed i will post it here..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top