Skip to content

Instantly share code, notes, and snippets.

@Deimosster
Created June 30, 2015 11:44
Show Gist options
  • Select an option

  • Save Deimosster/258d67cb65e3e6c0f0e8 to your computer and use it in GitHub Desktop.

Select an option

Save Deimosster/258d67cb65e3e6c0f0e8 to your computer and use it in GitHub Desktop.
Percona xtrabackup script
#!/usr/bin/env python
from datetime import datetime
import os
# set date parameter
today = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
# get systemname
systemname=os.uname()[1]
# set create archive command
exportcommand1='innobackupex --defaults-file=/etc/my.cnf --no-timestamp /mnt/backup/xtrabackup/'+systemname+'-'+today
exportcommand2='innobackupex --apply-log /mnt/backup/xtrabackup/'+systemname+'-'+today
os.system(exportcommand1)
os.system(exportcommand2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment