Created
January 3, 2015 23:21
-
-
Save brugnara/80f980e4e33da7b87408 to your computer and use it in GitHub Desktop.
Extract meteor deploy mongo credential and execute mongodump for you.
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 | |
# | |
# Daniele Brugnara | |
# | |
# usage: | |
# meteor mongo xyz.meteor.com --url | ./do.sh | |
# | |
read mongo_auth | |
db_name=`echo $mongo_auth | awk '{split($0,array,"/")} END{print array[4]}'` | |
ar=`echo $mongo_auth | tr '//' '\n' | grep client | tr ':' '\n' | head -n 2 | tr '@' '\n' | tr '\n' ':'` | |
username=`echo $ar | awk '{split($0,array,":")} END{print array[1]}'` | |
password=`echo $ar | awk '{split($0,array,":")} END{print array[2]}'` | |
host=`echo $ar | awk '{split($0,array,":")} END{print array[3]}'` | |
# echo $host | |
# echo $username | |
# echo $password | |
# echo $db_name | |
mongodump -h $host --port 27017 --username $username --password $password -d $db_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment