Created
March 9, 2016 09:15
-
-
Save abhishekdgeek/501f4832e939c14e46f1 to your computer and use it in GitHub Desktop.
Simple mongo db dumping shell script. Used BSON for more information and accuracy.
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/bash | |
# MongoDB Backup Script | |
NOW=$(date +"%m-%d-%Y-%H-%M") | |
NAME="backup.$NOW" | |
DB="mean-dev" | |
SERVER="localhost" | |
PORT="27017" | |
mongodump --host $SERVER -d $DB --port $PORT --out $NAME | |
tar -cvf $NAME.tar $NAME/ | |
rm -r $NAME | |
gzip $NAME.tar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment