Automatic MYSQL backup stopped working for some reason


I had a cron job run every week and it worked fine for a year or so. I noticed recently that it stopped working and I don’t know why. I have looked at the crontab through shell and everything looks fine. I also looked at the .sh file and it looks fine too.

I will post the crontab and .sh file, but will change the words/exact paths for security reasons.

0 2 * * 6 /home/hidden/backups/

This should run every Saturday at 2:00 am and backup my single MYSQL database.

cd /home/hidden/backups/
mkdir mysql
suffix=$(date +%y%m%d)
mysqldump --opt -uhidden -phidden -h localhost.hidden > mysql/hidden.$suffix.sql
tar -cf archives/mysql_backup.$suffix.tar mysql/*
rm -r mysql/

Note: if I run the ./ manually it works fine and make a backup of the database. I also do not receive an email showing any errors.

If anyone can help me out with the problem that would be great.


DreamHost does not allow you to store backups on your web hosting accounts. It’s possible that one of their maintenance scripts has found your backups and is removing them.

Try storing it to the DH backup servers


Also, we already run nightly MySQL backups, so there’s really very little point in running your own unless you store them somewhere outside our data center.


Use full paths inside your script, for mkdir, mysqldump, tar, and rm
If you don’t know the path, type ‘which tar’ and so on. Cron doesn’t necessarily use the same PATH environment that you use in your shell.