For many cron jobs, you don't need sudo.
For a user, simply use 'crontab -e' (no sudo)
If you really need to add an admin or root cron job, add it to the existing crontab at /etc/crontab or put a link to your script in the cron.hourly/daily/weekly/monthly folders
COMMON ISSUES:
- If you enter an invalid crontab entry, crontab will tell you upon exit but the warning message is easy to miss.
- A crontab entry with a truncated path (foo instead of /bin/foo) will fail.
- A crontab entry that is too complex, or requires shell commands that are not available to cron (but are available to you) will fail.
HOW TO TEST CRON:
Do a user-level 'crontab -e' and enter the following:
Try it as a shell command to make sure it works!
Code:
* * * * * DISPLAY=:0.0 /usr/bin/gnome-terminal -x top
Once each minute, a new window should spawn and run 'top'
If it does, your cron is working just fine.
IF YOUR CRON IS WORKING:
Try your crontab again as a user - but not for the middle of the night.
If it still doesn't work, post the crontab for us to see.
IF YOUR CRONTAB IS NOT WORKING:
Reinstall using:
Code:
sudo apt-get reinstall cron anacron
Bookmarks