The cronjob appears to run successfully because backup.sql is being created, but it has size of 0.
If I manually run the command, the backup.sql much larger.
I am sure this is something simple, but it is my first time setting up cronjobs,so any help would be appreciated. Thank you!
something to note is that when I run the command manually I do sudo before the command
I think that’s because you don’t have a folder set. The docker-compose command does not know what compose stack you’re referring to and fails. I’d use the full name of the container (From docker ps) and run it with a plain docker command. Something like this:
The backup.sql file is empty because the error output is going to stderr but you’re only piping stdout to the file. Check out this article for information about how to change that: https://linuxize.com/post/bash-redirect-stderr-stdout/