Created
March 24, 2014 21:49
-
-
Save mbrowne/9749944 to your computer and use it in GitHub Desktop.
Shell script to copy remote MongoDB database (and overwrite local copy)
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
#!/bin/bash | |
#SYNC MONGODB DATABASE FROM REMOTE SERVER | |
#NOTE: This overwrites the local copy of the database | |
remoteHost='yourhost.com' | |
remoteDbUser='root' | |
remoteDbPasswd='password123' | |
remoteDb='test' | |
localDb='test' | |
mongo $localDb --eval "db.dropDatabase(); db.copyDatabase('$remoteDb', '$localDb', '$remoteHost', '$remoteDbUser', '$remoteDbPasswd')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment