Created
July 13, 2012 09:14
-
-
Save nulltask/3103820 to your computer and use it in GitHub Desktop.
mongodump
This file contains hidden or 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 | |
BEGIN_TIME=`date` | |
EPOCH_TIME=`date +%s` | |
BASE_DIR=`date +%Y`/`date +%m`/`date +%d` | |
BACKUP_DIR=~almond-peak/backup/$BASE_DIR | |
mkdir -pv $BACKUP_DIR | |
mongodump --host localhost -o $BACKUP_DIR/mongodump-$EPOCH_TIME | |
for i in $BACKUP_DIR/* | |
do | |
tar zcvf $i.tgz $i | |
rm -frv $i | |
done | |
END_TIME=`date` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks!