I've got some problem. I have script execution scheduled but when time comes nothing happens.
#!/bin/sh
TIME=`date +"%d-%m-%Y"`
cd /var/www/flyer/data/www/
mysqldump -u root -ppasswd --databases db_name --create-options --default- character-set=utf8 --result-file=dump.sql
FILENAME="backup_$TIME.tar.gz"
tar -cpzf ../backups/$FILENAME somefolder dump.sql
rm dump.sql
chown flyer:flyer ../backups/$FILENAME
chmod 666 ../backups/$FILENAME
When I run script directly from from ssh as /root/backup.sh, everything works as it's supposed to. But when it is ran by cron, nothing happens.
grep CRON /var/log/syslog
shows that it was executed (Dec 19 01:21:01 vps-8463 /USR/SBIN/CRON[1299]: (root) CMD (sh /root/backup.sh >/dev/null 2>&1)
) but no archive is created. Cron task : 21 1 * * * sh /root/backup.sh >/dev/null 2>&1
Any ideas why this is happening?