Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save etagwerker/5800213 to your computer and use it in GitHub Desktop.
Save etagwerker/5800213 to your computer and use it in GitHub Desktop.
Bash script to perform MySQL incremental backups with Percona xtrabackup with Cron, starting with a full backup.
STAMP=`date +%Y%m%d%H%M`
echo "Iniciando backup @ $STAMP"
mkdir -p /var/backups/$STAMP
LAST_DIR=`ls /var/backups/inc | sort -n | tail -1`
xtrabackup --use-memory=1G --backup --target-dir=/var/backups/inc/$STAMP --incremental-basedir=/var/backups/inc/$LAST_DIR --user=root --password=<root-password>
echo "Fin backup @ $STAMP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment