Skip to content

Instantly share code, notes, and snippets.

@nulltask
Created July 13, 2012 09:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nulltask/3103820 to your computer and use it in GitHub Desktop.
Save nulltask/3103820 to your computer and use it in GitHub Desktop.
mongodump
#!/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`
@Prinzhorn
Copy link

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment