Created
July 15, 2017 05:49
-
-
Save efazati/e445a1f442af86cba04863f45bce0fb7 to your computer and use it in GitHub Desktop.
backup mongo with dropbox
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
MONGO_DATABASE="dbname" | |
APP_NAME="dbname" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
BACKUPS_DIR="/dropbox/backups/$APP_NAME" | |
BACKUP_NAME="$APP_NAME-$TIMESTAMP" | |
$MONGODUMP_PATH -d $MONGO_DATABASE | |
mkdir -p $BACKUPS_DIR | |
mv dump $BACKUP_NAME | |
tar -zcvf $BACKUPS_DIR/$BACKUP_NAME.tgz $BACKUP_NAME | |
#/dropbox/dropbox_uploader.sh $BACKUPS_DIR/$BACKUP_NAME.tgz '/backups/db' | |
mv $BACKUPS_DIR/$BACKUP_NAME.tgz /hard2/backup/db/$APP_NAME/ | |
rm -rf $BACKUPS_DIR/ | |
rm -rf $BACKUP_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment