Making a certain cron job
David Fleck
david.fleck at mchsi.com
Sun Sep 7 19:57:51 PDT 2003
On Sun, 7 Sep 2003, Jason Lieurance wrote:
> Thank you for the response. Does the date part (Date=`date +"%Y-%m-%d"`)
> go as part of the cron job? Thanks again.
Well, you could cram all this into a crontab line, but you'll probably
want to use the cron entry to run a script containing these commands.
This way, you can make the script more elaborate, do error-checking, have
possible alternate responses mailed, things like that.
For what you want to do, the script could be very simple:
#!/bin/sh
# send_http_log.sh : mails httpd logfile.
Date=`date +"%Y-%m-%d`
cat /var/log/http/${Date}-error_log | mail -s log web at ourdomain.com
exit
and then in the crontab have a line referring to the script:
0 1 * * * /usr/local/bin/send_http_log.sh
or, alternately, add the script into the /etc/periodic/* directories to
have it run by the system-wide cron.
--
David Fleck
dcf at aracnet.com
More information about the freebsd-questions
mailing list