Scheduling a task using cron doesn't work
Posted on 2004-11-05
I want to run a apache log rotation task every once a week on my server. I came up with a script call " rotatelog" that does the task. So I want to run this script on every friday. I tried two ways to set it up :
1) Schedule the task by running "crontab -u myusername -e" , and add one line to the cron file like this:
40 9 * * fri root rotatelog &
and after exit from the crontab, restart the crond service
2) put a file called "rotatelog.cron" in dir /etc/cron.d, which contains exactly the same line mentioned above. Then restart crond.
But neither way works so far, the rotatelog script never run.
Could any body figure out why? Is there something else I should do to schedule the task?
Thanks a lot