I use crontab -e
in ubuntu server for running a backup.sh file every night at 02:00 AM. I wrote: 00 02 * * * root /home/backup.sh
Then /etc/init.d/cron restart
When do crontab -l it shows:00 02 * * * root /home/backup.sh.
I can run backup.sh myself and It works fine.
But it did not work automatically by schedule.
|
|
||||
|
|
|
When you run your cron jobs as user jobs (editing jobs with Either put that line to Additional note is to make sure that you have all your programs like
EXAMPLE CRON FILE EXAMPLE SYSTEM CRON FILE |
|||||
|
|
Redirect the error messages to a log file and check that.
It's very likely a right or path problem. |
|||
|
|
|
There are two points to talk about:
|
|||
|
|
|
Here's what comes to my mind:
|
|||
|
|
|
Try editing crontab in this way :
and make sure to give execution permission to the script. |
|||
|
|
|
You don't need the 'root' part. That's only for /etc/crontab. Try this instead:
|
|||
|
|
|
And make sure your crontab has a carriage-return at the end of the line that's supposed to run. This is a known bug in many Cron implementations that prevents the last line of the file from executing. Better yet, just put a comment at the bottom of your crontab file with a '#' character. |
|||
|
|