The aim of "checkfiledate" is to search for new files in a specific directory, and send an alert email under certain conditions
You must install a mail server (like "sendmail", "exim", "postfix"), a mail client (like "mail") and "find" plus "egrep" utilities.
-
Create a file called "filelist.txt" (there is a template in "filelist.txt.dist" with instructions)
-
Create a file called "maillist.txt", with one mail address per line
-
Create a crontab that execute "checkfiledate.sh"
root@local:~# cat /etc/cron.d/checkfiledate
00 00 * * * root /opt/checkfiledate/checkfiledate.sh > /var/log/checkfiledate.log 2>&1
-
Stay tuned to your mail inbox!
There is two posible parameters:
-
mailtest => Send email to al target address in "maillist.txt"
$ ./checkfiledate.sh mailtest
-
dryrun => Do the check, but without sending any mail
$ ./checkfiledate.sh dryrun
If you run the script in the weekday 0 (sunday), it send a "checkpoint" mail with "WEEKLY TEST EMAIL" subject