Skip to content

Instantly share code, notes, and snippets.

@balibali
Created January 14, 2011 20:22
Show Gist options
  • Save balibali/780167 to your computer and use it in GitHub Desktop.
Save balibali/780167 to your computer and use it in GitHub Desktop.
mongodump で適当バックアップ用スクリプト
#!/bin/sh
DAYNUMOFWEEK=$(date +%u)
# delete log file of the last week
if [ -f dump$DAYNUMOFWEEK.tar.gz ]
then
rm -v dump$DAYNUMOFWEEK.tar.gz
fi
# dump & compress mongo data
mongodump
tar czfv dump$DAYNUMOFWEEK.tar.gz dump
rm -rv dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment