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

Next revision
Previous revision
innobackupx_scripted_to_backup_daily [2011/03/02 01:19] – created k2patelinnobackupx_scripted_to_backup_daily [2020/08/10 02:35] (current) – external edit 127.0.0.1
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 root@remote.backup.com "cat - > /root/bkuptest/Backup/test.tar" if /usr/bin/innobackupex-1.5.1 --no-timestamp --no-lock --user=root --password=testpassword --stream=tar ./ | ssh root@remote.backup.com "cat - > /root/bkuptest/Backup/test.tar"
 then then
-        if ssh root@remote.backup.com "/usr/local/bin/mybackup.sh"+        if ssh root@remote.backup.com "/usr/bin/mybackup.sh"
                 then                 then
                 echo "Backup Done" | mail -s "[Backup] backup done Complete" ketan@email.com                 echo "Backup Done" | mail -s "[Backup] backup done Complete" ketan@email.com
Line 21: Line 21:
         echo "Backup Failed" | mail -s "[Backup] master Failed" ketan@email.com         echo "Backup Failed" | mail -s "[Backup] master Failed" ketan@email.com
 fi fi
 +</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.1299028759.txt.gz · Last modified: 2020/08/10 02:30 (external edit)