Script to report linux login yesterday

Create a script for yesterday.. yesterday.sh

#jmazaredo 4-19-2016
#Get the date month and date cut the necessary date 
ystd=$(date --date yesterday | cut -d' ' -f2,3) tdy=$(date --date today | cut -d' ' -f2,3)
#show the date yesterday Month and date 
echo ${ystd} #show the date today Month and date echo ${tdy}
#grep the date try checking the tdy since you may have no login yesterday 
last | grep "$tdy"

Crontab Entry
email it
  • 8 * * * /user/yesterday.sh | mail -s "Last Login Yesterday" me@example.net

Comments

Popular posts from this blog

Water Wonder Resort

Redirect apache request to another domain

Can't use proxy because no authentication schemes are fully configured.