Date: Sun, 7 Sep 2003 21:57:15 -0500 (CDT) From: David Fleck <david.fleck@mchsi.com> To: freebsd-questions@freebsd.org Subject: Re: Making a certain cron job Message-ID: <20030907214740.E1157@grond.sourballs.org> In-Reply-To: <14243.205.240.37.184.1062989058.squirrel@www.vipersystems.biz> References: <13696.205.240.37.184.1062986048.squirrel@www.vipersystems.biz> <20030907212701.K1087@grond.sourballs.org> <14243.205.240.37.184.1062989058.squirrel@www.vipersystems.biz>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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@aracnet.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030907214740.E1157>
