Skip to content

Instantly share code, notes, and snippets.

@ootput
Created April 6, 2010 06:21
Show Gist options
  • Save ootput/357284 to your computer and use it in GitHub Desktop.
Save ootput/357284 to your computer and use it in GitHub Desktop.
#!/bin/sh
MYSQLBACKUP=/home/$USER/.mysql_backup
DB_NAME=dump.sql
[ -f $MYSQLBACKUP/$DB_NAME.1 ] && mv -f $MYSQLBACKUP/$DB_NAME.1 $MYSQLBACKUP/$DB_NAME.2
[ -f $MYSQLBACKUP/$DB_NAME.0 ] && mv -f $MYSQLBACKUP/$DB_NAME.0 $MYSQLBACKUP/$DB_NAME.1
[ -f $MYSQLBACKUP/$DB_NAME ] && mv -f $MYSQLBACKUP/$DB_NAME $MYSQLBACKUP/$DB_NAME.0
ssh USER@host mysqldump -h MYSQL.HOST -u USER -pPASSWORD DBNAME > $MYSQLBACKUP/$DB_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment