Created
May 11, 2021 15:39
-
-
Save zerefdev/0a51a4a77efa5b3417059b2309045917 to your computer and use it in GitHub Desktop.
MongoDB Backup Script
This file contains 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
#!/bin/sh | |
BACKUP_NAME=mongo_backup_`date +"%d-%m-%Y"`.gz | |
DB=db_name | |
USER=db_user | |
PASS=db_password | |
echo "Dumping MongoDB $DB database to compressed archive" | |
mongodump --db $DB --username=$USER --password=$PASS --archive=$HOME/backups/$BACKUP_NAME --gzip | |
echo "Backup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment