Skip to content

Instantly share code, notes, and snippets.

@efazati
Created July 15, 2017 05:49
Show Gist options
  • Save efazati/e445a1f442af86cba04863f45bce0fb7 to your computer and use it in GitHub Desktop.
Save efazati/e445a1f442af86cba04863f45bce0fb7 to your computer and use it in GitHub Desktop.
backup mongo with dropbox
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