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

Help with a script 1

Status
Not open for further replies.

rejohn

Technical User
Jun 23, 2004
21
US
I would like to write a script involving 'stat', 'epoch' to find out how many users and who haven't touched their accounts in 24 months.
 
lastlog -t 365 | awk '{print $1}' | tail +2 | sort > /tmp/last12mo.$$.tmp

cut -d: -f1 /etc/passwd | sort > /tmp/allusers.$$.tmp

echo "The following users haven't logged in for more than 12 months"
echo "-------------------------------------------------------------"
comm -13 /tmp/last12mo.$$.tmp /tmp/allusers.$$.tmp

rm /tmp/*.$$.tmp
 
could you use something like this?

Code:
find /path_to_files -mtime -365 -maxdepth 1 -type f

i may well be barking up the wrong tree though...

Kind Regards
Duncan
 
sorry... info is in a log file - so i am barking up the wrong tree!

Kind Regards
Duncan
 
are you asking how to write it in perl or as a Unix shell script?
 
I was thinking along the lines of a perl script, but I more comfortable with shell scripts...
 
I have a list of user accounts in a file and I want to run finger against that file and sort them the "Mail last read" field. How would a perl script look for something like that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top