The mysql backup script mentioned in this post was working fine when run manually as root, but was not working when run from cron - the resulting file was only 20 bytes. The rclone command was working, so apparently only the mysqldump command was not working.
Troubleshooting - checked the path which was being found by the
MYSQLDUMP="$(which mysqldump)"
line by declaring a LOGFILE=/full/path/to/mylog.log and
echo $MYSQLDUMP > $LOGFILE
Running the script as root gave the correct path as
/opt/bitnami/something/mysqldump
but the root cron was returning a blank - apparently cron has a restricted PATH, and which does not return a path in /opt since /opt is not in cron's PATH -
https://linux.die.net/man/1/which
https://help.dreamhost.com/hc/
Replacing the MYSQLDUMP variable initialization with the full path instead of the which statement solved the issue, and then rclone could move the file to gdrive also, not needing a separate cron job as in the previous post.
This issue would affect all those servers which have binaries in paths to which cron does not have access. Bitnami servers and more.
Other references:
No comments:
Post a Comment