I have the following script in /etc/cron.daily/, it works perfectly if I execute it manually but never runs via cron. There are other scripts in cron.daily that do execute however.
#!/bin/bash
DATE=`date +%Y%m%d`
FILENAME=mysql_$DATE.tar.gz
DESDIR=/data/mysqlbackup/
echo Deleting backups older than 30 days
echo Files deleted:
find /data/mysqlbackup/ -mtime +30 -type f -ls
find /data/mysqlbackup/ -mtime +30 -type f -delete
echo Backing up all databases
mysqldump -u backup -p --all-databases --events | gzip > $DESDIR$FILENAME
echo Backup complete:
ls -lh $DESDIR
What could the issue be?
I'm running Ubuntu 14.04
syslog
? – Melebius May 25 '17 at 12:36echo foo > /tmp/cron.test
at the beginning of the script. Is the file/tmp/cron.test
created? Also, how are you running the script? Did you just put it in/etc/cron.daily/
and expect it to run? If so, please [edit] your question and explain that, and tell us the name of your script (the name matters here). – terdon May 25 '17 at 13:09echo foo > /tmp/cron.test
at the beginning of the script. Is the file/tmp/cron.test
created? Also, how are you running the script? Did you just put it in/etc/cron.daily/
and expect it to run? If so, please [edit] your question and explain that, and tell us the name of your script (the name matters here). – terdon May 25 '17 at 13:09