Copy from git.oeru.org.
Find a file
2023-05-25 17:24:40 +12:00
.gitignore new Mongo DB hourly backups, rotating 2018-05-22 13:00:07 +12:00
dbbackup-mongo updated default path to new convention 2023-05-25 17:16:40 +12:00
dbbackup-mongo-cron updated default path to new convention 2023-05-25 17:16:40 +12:00
default-mongo.conf-sample new Mongo DB hourly backups, rotating 2018-05-22 13:00:07 +12:00
LICENSE Initial commit 2018-02-08 03:44:40 +00:00
README.md rippling new directory convention 2023-05-25 17:24:40 +12:00

This is a bash script, run by cron, which creates backups using a editable command. This is used for, say, backing up Docker-based MongoDBs, to a designated directory. Each backup file created (usually hourly) is timestamped. 24 hourly instances, 7 daily, 4 weekly, 12 monthly, and 7 yearly versions of each file being backed up are retained automatically. A "Success" or "Error" log is automatically sent to a designated email address. To install, create the directory - /home/data/scripts/mongobackup by default - for this code.

git clone git@git.oeru.org:oeru/mongobackup.git /home/data/scripts/mongobackup

Copy default-mongo.conf-sample to default-mongo.conf and edit it to customise it to set various directories (you'll need to create those that don't yet exist!)

cp default-mongo.conf-sample default-mongo.conf

Link the cron file to enable it

ln -sf /home/data/scripts/mongobackup/dbbackup-mongo-cron /home/data/scripts/cron.d

To run it manually, in this case testing hourly backups...

/home/data/scripts/mongobackup/dbbackup-mongo --verbose --hourly