Issue
I am trying to take back up in my cpanel using cron jobs.
My script is like this
/usr/bin/mysqldump --user=username --password=password --host=localhost dbname | gzip > /home/username/backups/dbbackup_$date.sql.gz
and in backup.sh
#!/bin/bash
date=`date +%Y%m%d_%k%M`;
/usr/bin/mysqldump --user=username --password=password --host=localhost dbname | gzip > /home/username/backups/dbbackup_$date.sql.gz
and i have set the time for every 5 mins. But its not happening. Please suggest me where i am doing wrong
Solution
can you give the exact line of cron job? I tried this:
date=`date +%Y%m%d_%k%M`
mysqldump -uroot -p12345 -h127.0.0.1 db | gzip > /home/ubuntu/root/db_$date.sql.gz
and it worked for me, may be there is some problem with your cron!!
To run every 5 minutes this is the syntax:
*/5 * * * * sh /home/ubuntu/root/backUpScript.sh
Answered By - thekosmix Answer Checked By - Pedro (WPSolving Volunteer)