PDA

View Full Version : Yet Another CRON Question


symo
7-2-02, 05:30 PM
I want to use CRON to email my access_log to me every week. Right now it is set up to send it everyday for testing purposes. If it works, I'll change it to reflect that it will only send on Sunday. Does this CRONTAB file look correct?

# This will email the access_log file to me every morning at 2:00 AM and log errors.
0 2 * * * :
mail -s "PowWeb Access Log" -a www/d/domain/logs/access_log -t user@domain.com
>>/www/d/domain/logs/script.log 2>>/www/d/domain/logs/script.err

Thanks for the help.

Symo

ffejy
7-2-02, 07:20 PM
I don't know much about unix commands, but I don't think you should have the colon after the 02*** and everything should be on one line. You might have to enclose the whole command in quotes, I don't know. It is easier just to have it execute a script, like this:

0 2 * * * /www/u/username/htdocs/your/script.php >>/www/u/username/logs/script.log 2>>/www/u/username/logs/script.err

and then in script.php you'll have to learn how to send attachements :)