User Tools

Site Tools


innobackupx_scripted_to_backup_daily

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
innobackupx_scripted_to_backup_daily [2011/03/01 20:19]
k2patel
innobackupx_scripted_to_backup_daily [2011/03/01 20:23]
k2patel
Line 5: Line 5:
  * Following script need you to change some variables.\\  * Following script need you to change some variables.\\
  
-== **Master server** ==+== Master server ==
  
 <code bash | /​usr/​bin/​pushbackup.sh>​ <code bash | /​usr/​bin/​pushbackup.sh>​
Line 22: Line 22:
 fi fi
 </​code>​ </​code>​
 +
 +== Remote Server ==
 +
 +<code bash | /​usr/​bin/​mybackup.sh>​
 +#!/bin/bash
 +
 +cd /​root/​bkuptest/​Backup
 +if tar -ixvf test.tar
 +then
 +/​etc/​init.d/​mysqld stop
 +/bin/sleep 20
 +if ps awux | grep -v grep | grep mysqld
 +  then
 +    exit $?
 +  else
 +   echo "mysql stopped"​
 +fi
 +if rm -rf /​var/​lib/​mysql/​*
 +  then
 +        echo "​remove done"
 +   if /​usr/​bin/​innobackupex-1.5.1 --copy-back /​root/​bkuptest/​Backup/​
 +    then 
 +        echo "copy back done"
 +     if chown -R mysql:mysql /​var/​lib/​mysql
 +      then 
 +        echo "​permission Done"
 +        /bin/sleep 20
 +       /​etc/​init.d/​mysqld start
 +          /bin/sleep 20
 +                if ps awux | grep -v grep | grep mysqld
 +                then
 +                  echo "mysql started"​
 +                else
 +                  exit $?
 +                fi
 +          if /​usr/​bin/​innobackupex-1.5.1 --apply-log --user=root --password=testpassword /​root/​bkuptest/​Backup/​
 +           then
 +                echo "​applying log done"
 +            if rm -rf /​root/​bkuptest/​Backup/​*
 +            then
 +                echo "​removing done"
 +                exit $?
 +            else
 +             echo "​failed removing backup"​ | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +             exit $?
 +           fi
 +          else
 +            echo "​Failed applying log" | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +            exit $?
 +          fi
 +       else
 +        echo "​Failed setting up permission"​ | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +        exit $?
 +       fi
 +     else
 +      echo "Filed on Copy Back" | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +      exit $?
 +     fi
 +   else
 +    echo "​Failed Removing Mysql Files" | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +    exit $?
 +   fi
 +fi
 +else
 +echo "​Failed everything on destination"​ | mail -s "​[Backup] remote.backup.com Failed Backup " ketan@email.com
 +fi
 +</​code>​
 +
innobackupx_scripted_to_backup_daily.txt ยท Last modified: 2011/03/01 20:23 by k2patel