2011-12-30

Scratch of the day - Back dated date

Did some sysctl tuning and need to monitor the log file every "yesterday". This is what I've managed to split out from "strftime" manual (via "date") :
# date
Fri Dec 30 09:59:27 MYT 2011

# date -v -1d +%b\ %Oe
Dec 29


With this, make cron send me an email with filtered entries of /var/log/messages :
1 1 * * * grep "`date -v -1d +\%b\ \%Oe`" /var/log/messages | mail -s "Yesterday ..." root@example.com

See ya !!!

No comments: