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.

Revisions

  1. Deimosster created this gist Jun 30, 2015.
    42 changes: 42 additions & 0 deletions xtrabackup.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    #!/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)