I need to run mongodump on my database everyday.
How do I automate this reasonably? Every day I want a new folder created with the timestamp and the dump data inside.
Thanks.
Look at
https://github.com/micahwedemeyer/automongobackup
Otherwise use standard tools like cron or shell scripting for wrapping the mongodump call.
I have a super quick handy script. Sometimes I create a cron job for one of my database.
ssh root@hostname "mongodump --db myDatabaseName --out /tmp/mongo-backup ; zip -r /tmp/mongo-backup$(date "+%Y.%m.%d").zip /tmp/mongo-backup ; rm -rf /tmp/mongo-backup" ;
scp root@hostname:/tmp/mongo-backup$(date "+%Y.%m.%d").zip ./
The above script does two things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With