Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # MongoDB backup script
- # This script is licensed under GNU GPL version 2.0 or above
- # It makes a folder under BACKUP folder and compress it into .tar.gz.file
- # Using another script we will remove older backups later
- # ---------------------------------------------------------------------
- ### System Setup ###
- BACKUP=""
- ### Mongo Setup ###
- MUSER=""
- MPASS=""
- MHOST="localhost"
- ### Binaries ###
- TAR="$(which tar)"
- GZIP="$(which gzip)"
- MONGODUMP="$(which mongodump)"
- PURGE="purgebackup.sh"
- ### Today + hour in 24h format ###
- NOW=$(date +"%F")
- FOLDER=$BACKUP/$NOW
- FOLDERGZ=$BACKUP/$NOW.tar.gz
- mkdir $BACKUP/$NOW
- cd $BACKUP/$NOW
- $MONGODUMP -u $MUSER -p $MPASS --out $FOLDER
- $TAR -cvf $FOLDERGZ $FOLDER
- rm -rf $BACKUP/$NOW
- cd /root/scripts
- ./$PURGE --force --ages=1,2,3,4,5,6,7,15,30,60,90,120,365 --directory=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement