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: /bin/backups/mysqlbackup.sh
#!/bin/bash
mkdir /home/lv_admin/uslons001/`date +%d%m%y`
cd /home/lv_admin/uslons001/`date +%d%m%y`
tar -czf mysql.tar.gz /var/lib/mysql
tar -czf www.tar.gz /var/www
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.
36 10 * * 5 /bin/backups/mysqlbackup.sh
..there is also nothing in the /var/log/cron.log file, so no errors are being logged. (even after enabling cron logging in the /etc/syslog.conf file
sudo chmod +x /etc/cron.weekly/mysqlbackup.sh
would still not make the script run weekly. Cron ignores files with extensions in those directories. And in general, scripts shouldn't have extensions. – geirha Mar 05 '11 at 12:32/etc/crontab
,run-parts
is used to run the jobs in/etc/cron.{daily,weekly,monthly}
if anacron is "not installed". run-parts(8) in turn explains what characters are allowed in the filenames. I believe the main reasoning behind it is to be able to easily disable a job by simply renamingjobname
tojobname.disabled
or similar. – geirha Aug 22 '13 at 14:53