Created
April 5, 2020 07:38
-
-
Save yvesh/02df5f84a2ce02d17bec2bd9ded17f92 to your computer and use it in GitHub Desktop.
Docker MongoDB Backup script for cronjobs on Docker Host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
username="" | |
password="" | |
database="" | |
auth_database="admin" | |
target="/backup/mongo-$(date +%Y-%m-%d-%H).archive" | |
docker exec mongo_db_container sh -c 'exec mongodump --username $username --password $password --authenticationDatabase $auth_database -d $database --archive' > "$target" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment