crontab fails but command line works -
Having an odd problem running a mysqldump via crontab. I have the script running on other servers and they work fine, so not sure how to actually troubleshoot, but the script looks like the following;
rm -rf /archives/server_baks/*
if mysqldump -u root --password=pwhere --databases tables_here --add-locks | gzip > /archives/server_baks/mysql.$(date +%Y-%m-%d_%H%P).sql.gz
echo "ERROR: The backup failed."
If I run it as a cronjob as root, it finishes in a second and a 20k file is there. If I run it from the command line as root it does the backup (takes a few minutes) but does complete the backup and can be unzipped and read successfully.
Any ideas why / how?