On my Ubuntu box I have a crontab setup for my normal user that has the following:
0 0 * * * sudo mysqldump -u root -h localhost --all-databases | gzip > /home/<user>/mysqlbackups/db_`date +%F`.sql.gz
When I run the script from shell it runs without any issue.
sudo mysqldump -u root -h localhost --all-databases | gzip > /home/<user>/mysqlbackups/db_`date +%F`.sql.gz
But with it set as a cron job it's not running at all.
I have my user set in my cron.allow file as well (had to create the file as it didn't exist previously).
Kinda stumped at the moment and not sure what else to tweak/try to get this to run automatically at midnight.
Any ideas?
Thanks!
edit: Removed the 'sudo' and it runs fine on my normal shell execution. I'll find out if it runs off the cron automatically tonight.
sudo
will not be needed, and the effect is the same. – zwets Oct 08 '13 at 13:38