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
Next revision
Previous revision
innobackupx_scripted_to_backup_daily [2011/03/02 01:19]
k2patel
innobackupx_scripted_to_backup_daily [2011/03/02 01: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 12: Line 12:
 if /​usr/​bin/​innobackupex-1.5.1 --no-timestamp --no-lock --user=root --password=testpassword --stream=tar ./ | ssh [email protected] "cat - > /​root/​bkuptest/​Backup/​test.tar"​ if /​usr/​bin/​innobackupex-1.5.1 --no-timestamp --no-lock --user=root --password=testpassword --stream=tar ./ | ssh [email protected] "cat - > /​root/​bkuptest/​Backup/​test.tar"​
 then then
-        if ssh [email protected] "/usr/local/​bin/​mybackup.sh"​+        if ssh [email protected] "/​usr/​bin/​mybackup.sh"​
                 then                 then
                 echo "​Backup Done" | mail -s "​[Backup] backup done Complete"​ [email protected]                 echo "​Backup Done" | mail -s "​[Backup] backup done Complete"​ [email protected].com
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 " [email protected]
 +             exit $?
 +           fi
 +          else
 +            echo "​Failed applying log" | mail -s "​[Backup] remote.backup.com Failed Backup " [email protected]
 +            exit $?
 +          fi
 +       else
 +        echo "​Failed setting up permission"​ | mail -s "​[Backup] remote.backup.com Failed Backup " [email protected]
 +        exit $?
 +       fi
 +     else
 +      echo "Filed on Copy Back" | mail -s "​[Backup] remote.backup.com Failed Backup " [email protected]
 +      exit $?
 +     fi
 +   else
 +    echo "​Failed Removing Mysql Files" | mail -s "​[Backup] remote.backup.com Failed Backup " [email protected]
 +    exit $?
 +   fi
 +fi
 +else
 +echo "​Failed everything on destination"​ | mail -s "​[Backup] remote.backup.com Failed Backup " [email protected]
 +fi
 +</​code>​
 +
innobackupx_scripted_to_backup_daily.txt ยท Last modified: 2011/03/02 01:23 by k2patel