Redir 每日記錄回報

#!/bin/sh
/bin/cat /var/log/syslog* | grep -a "ubuntu redir" | grep "`date --date=yesterday +%b %e`" > /root/diary.log
/bin/zcat /var/log/syslog.*.gz | grep -a "ubuntu redir" | grep "`date --date=yesterday +%b %e`" >> /root/diary.log
if [ -s /root/diary.log ] ;
then
  /bin/cat /root/diary.log| mail -s "Redir Log -- `date --date=yesterday +%b %e`" user@mail.address
fi
This entry was posted in Linux, Shell Script. Bookmark the permalink.