Ubuntu Server Cron Job Not Working

Ubuntu Server Cron Job Not Working

I have Ubuntu 11.04 installed to serve my own server to host my blogs and subversion repository. I had the history of losing my whole server’s data when my VPS host company did some terrible things. So I decide to setup a cron job to backup my SVN repository on daily basis by simply using svnadmin. I used command:
crontab -e
and then enter:
5 8 * * *          /bin/bash /home/user1/Dropbox/backups/scripts/svndump.sh > /tmp/cron.log
to the end of file and save it. However, the cron job never runs and the log file was never created. I tried on root user as well and also without any luck. In the end I have found out this is actually a bug on the Ubuntu system ( not sure other distros though ) from Ubuntu Help:
When adding a new entry to a blank crontab, forgetting to add a newline
 at the end is a common source for the job not running. If the last line
 in the crontab does not end with a newline, no errors will be reported
 at edit or runtime, but that line will never run. 

See man crontab for more information.
This has already been suggested as a bug.
So what I did was to add a few new lines to the end of “crontab -e” output and then restart the cron server:
service cron restart
Now my cron job works perfectly. I have my backup runs everyday and it uploads to dropbox automatically, I don’t need to worry about lose data anymore.

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!