-
-
Save msaiducar/a75235db0d0267eba902a8988f2f9289 to your computer and use it in GitHub Desktop.
Mongodump Shell Script for Cronjob
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 | |
MONGO_DATABASE="dbname" | |
APP_NAME="appname" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
BACKUP_NAME="$APP_NAME-$TIMESTAMP.gz" | |
BACKUP_PATH="/home/path/" | |
BACKUPS_DIR="$BACKUP_PATH/$BACKUP_NAME" | |
$MONGODUMP_PATH --host $MONGO_HOST --port $MONGO_PORT -d $MONGO_DATABASE --archive=$BACKUPS_DIR --gzip --quiet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment