Skip to content

Instantly share code, notes, and snippets.

@atma
Created January 8, 2011 06:55
Show Gist options
  • Save atma/770626 to your computer and use it in GitHub Desktop.
Save atma/770626 to your computer and use it in GitHub Desktop.
Backup the project into Dropbox dir
#!/bin/bash
PRJ='project'
DROPBOX_DIR='/home/atma/Dropbox/backups'
PROJECT_DIR='/home/atma/www/project'
MHOST='localhost'
MUSER='root'
MPASS='pass'
MBASE='project'
#NOW=$(date +"%Y-%m-%d_%H")
if [ ! -d $DROPBOX_DIR/$PRJ ]; then
mkdir -p $DROPBOX_DIR/$PRJ
fi
cd $DROPBOX_DIR/$PRJ
mysqldump --extended-insert --add-drop-table --allow-keywords -q -c -u $MUSER -h $MHOST -p$MPASS $MBASE > $MBASE".sql"
tar -czf $MBASE.sql.tar.gz $MBASE".sql"
rm -f $MBASE".sql"
tar -czf $PRJ.tar.gz $PROJECT_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment