Setup CRON weekly backup
Posted
by
sadmicrowave
on Ask Ubuntu
See other posts from Ask Ubuntu
or by sadmicrowave
Published on 2011-03-04T13:46:16Z
Indexed on
2011/03/04
15:33 UTC
Read the original article
Hit count: 311
I want to make a backup of my /var/lib/mysql
and /var/www
folders and save them as tar.gz files to my mounted network file server (uslons001).
Here is my bash file located in: /etc/cron.weekly/mysqlbackup.sh
#!/bin/bash
mkdir ~/uslons001/`date +%d%m%y`
tar -czf ~/uslons001/`date +%d%m%y`/mysql.tar.gz /var/lib/mysql
tar -czf ~/uslons001/`date +%d%m%y`/www.tar.gz /var/www
tar -czf ~/uslons001/`date +%d%m%y`.tar.gz ~/uslons001/`date +%d%m%y`
echo Backup Completed `date` >> ~/backuplog
Which works PERFECTLY fine when I execute it in a cmd shell but when I setup the cron job it never runs, so I'm not setting the cron job up properly. My cron job looks like this.
30 7 * * fri /etc/cron.weekly/mysqlbackup.sh
Which should execute at 7:30AM every Friday...
What am I doing wrong?
UPDATE1 - change the cron job line to the following:
44 8 * * 5 /etc/cron.weekly/mysqlbackup.sh
with still no luck...is there a cron error log file that I can read to help pin point where the problem is?
© Ask Ubuntu or respective owner