MySQLZRM extract the backup to mysql

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy 🙂

Advertisements

MySQLZRM extract the backup to mysql

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy 🙂

MySQLZRM extract the backup to mysql

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy 🙂

MySQLZRM extract the backup to mysql

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy 🙂

Rename a host in BackupPC

Follow the below steps to rename a host in BackupPC.
1. Stop BackupPC service :

service backuppc stop

2. Login to the configuration folder

cd /etc/BackupPC

2. Change the host file to the corresponding one :

vi hosts

*change old_host to new_host*

3. Rename the pl file in pc folder :

cd pc

mv old_host.pl new_host.pl

4. Make the changes in the backup location (I assume your backup is storing in the location /backup):

cd /backup/filesystem/pc/

mv old_host new_host

5.Start Backuppc service:

service backuppc start

6. Login to the backuppc console and make sure that the changes are replicated there.

 

Enjoy 🙂

Bash script to take Mysqldump hourly and daily

Create a script as below and make it executable:

#!/bin/bash
Now_hourly=$(date +%d-%b-%H_%M)
Now_daily=$(date +%d-%b-daily)
if [ "$1" == "hourly" ]; then
/usr/bin/mysqldump --all-databases | gzip -c | cat > /Backup_location/mysql_dump_all$Now_hourly.sql.gz
elif [ "$1" == "daily" ]; then
/usr/bin/mysqldump --all-databases | gzip -c | cat > /Backup_location/mysql_dump_all$Now_daily.sql.gz
else
echo "Error. Enter hourly or daily";
fi

Now add the script in crontab for the hours it should run.

15,30 1,3 * * * script_name hourly
10,20 2,4 * * * script_name daily

Hourly backup will run at 01:15,01:30,03:15 and 03:30

Daily backup will run at 02:10,02:20,04:10 and 04:20 (since name would be same, it will replace each daily backup before)

Get notification after every successful backup from BackupPC

Edit the configuration in BackupPC is as below :

Edit config –> Backup Settings –> User commands -> DumpPostUserCmd as
/theg/email.sh $xferOK $host $type $client $hostIP $share $XferMethod $sshPath $cmdType
where /theg/email.sh is the custom script.

Below are the contents of the email.sh script :

 

#!/bin/bash
# script to send simple email
# Email To ?
EMAIL=”your_email_address”
# Email text/message
EMAILMESSAGE=”/tmp/emailmessage.txt”

# Grab the status variables
xferOK=$1
host=$2
type=$3
client=$4
hostIP=$5
share=$6
XferMethod=$7
sshPath=$8
cmdType=$9

# Check if backup succeeded or not.
if [[ $xferOK == 1 ]]; then
        STATUS=”SUCCESS”
else
        STATUS=”FAILED”
fi

# email subject
SUBJECT=”[BackupPC] $STATUS for host: $client”

# Email text/message
echo “Filesystem backup for $host $STATUS” > $EMAILMESSAGE
echo “” >>$EMAILMESSAGE
echo “Type: $type” >>$EMAILMESSAGE
echo “Client: $client” >>$EMAILMESSAGE
echo “Host: $host” >>$EMAILMESSAGE
echo “Host IP: $hostIP” >>$EMAILMESSAGE
echo “Share: $share” >>$EMAILMESSAGE
echo “XferMethod: $XferMethod” >>$EMAILMESSAGE
echo “sshPath: $sshPath” >>$EMAILMESSAGE
echo “cmdType: $cmdType” >>$EMAILMESSAGE

# send an email using /bin/mail
/bin/mail -s “$SUBJECT” “$EMAIL” < $EMAILMESSAGE

Enjoy 🙂