I created a cron job to do a daily backup, to store it in the directory /backups
This backups directory is located at the root [/] of the VPS server and is a separate backups partition provided by our VPS host. IE it's stored on a different disk.
So I created a little shell script to run backups and store them there.
#!/bin/sh
mysqldump --all-databases | gzip > /backups/dbbackup-`date +%Y-%m-%d`.sql.gz
This creates a .gz backup with the date attached. It works because when I run it I get what I want.
But I want this in a cron job. I edited crontab and set it to run at 9pm every night.
0 21 * * * /backups/DBBackups.sh
I check the cron log this morning and it ran,
Jun 20 21:00:01 973900 CROND[13279]: (root) CMD (/backups/DBBackups.sh)
But there is no file in the /backups directory.
Where am I going wrong here? Would it spit out an error somewhere that I'm not checking?
I'm still a beginner at this stuff. Later on I'd like to export a specific database by table because a 2gb .sql file is hard to work with should I ever need it. Plus I will probably hit some kind of max file size soon. But leave that for me. If anyone can help get this script running correctly that would be much appreciated.