I'm running a Meteor application using MUP for deployment. So on the server I created a backup-script, which looks like this:
#!/bin/sh
#export mongodump
docker exec -it mongodb mongodump --archive=/root/mongodump.gz --gzip
#create datestring
filedate=$(date +%Y-%m-%d_%H-%M-%S)
#put dump export in file
docker cp mongodb:/root/mongodump.gz mongodump_$filedate.gz
All good so far and all works as expected.
The weird problem starts when I add the script to a cronjob
0 1 * * * /home/user1/backup.sh
This also works, i.e. the mongodump.gz
is added properly. However, for any reason the backup is always the same (matching SHA-256-HASH) as long as the cronjob creates the backup. When I run the backup script manually again, SHA-Hash and filesize of the dump changes. The next time the cronjob backup is called, it is the same as the previous created backup.
Any ideas what's happening here?