Dear all,
I am trying to write a back up scripts for all database at my office; so, I wrote a mysqldump script and trying to use crontab to schedule run the daily backup. However, the backup sql file is generated, but with an empty content. It seems that the cron daemon does run the job, but return an empty file. I tried running the script on command line and it worked just fine (the proper backup script was returned). Why does my backup script work with out problem when I execute it manually from command line but not work from crontab/cron daemon?
All backup scripts and the crontab file were written by root account. Below is my short back up script and the crontab file:
I am trying to write a back up scripts for all database at my office; so, I wrote a mysqldump script and trying to use crontab to schedule run the daily backup. However, the backup sql file is generated, but with an empty content. It seems that the cron daemon does run the job, but return an empty file. I tried running the script on command line and it worked just fine (the proper backup script was returned). Why does my backup script work with out problem when I execute it manually from command line but not work from crontab/cron daemon?
All backup scripts and the crontab file were written by root account. Below is my short back up script and the crontab file:
Code:
sh-3.2# crontab -l
55 11 * * * root /bin/sh /Volumes/Pharmakon/bin/backup/database.sh
sh-3.2#
Code:
sh-3.2# more /Volumes/Pharmakon/bin/backup/database.sh
/usr/bin/mysqldump -u root --password=xxx --all-databases >/Volumes/Pharmakon/backup/databases/backup.sql
sh-3.2#