Sha256: 16fa001d60af7b5d8767c21cc3c5b4f5bf4125890e2393145408f5cdc7caf74f

Contents?: true

Size: 1.33 KB

Versions: 66

Compression:

Stored size: 1.33 KB

Contents

<%
  @path = "/mnt/db-backup-tools/rubber-xtrarestore.sh"
	@perms = 0755
	@backup = false
%>#!/bin/bash
# Variables
LOGFILE="/tmp/rubber-xtrarestore-log"
# Take the file from STDIN, write it into a real file, extract it, service mysql stop,
# then mkdir /mnt/mysql/data & /mnt/mysql/log (move old ones out of the way)
# then innobackupex --copy-back . in the extracted folder, then service mysql start
# Create a temporary folder
rm -rf /mnt/db_restore
mkdir -p /mnt/db_restore
# Write STDIN into file
cat > /mnt/db_restore/current.tar.gz
cd /mnt/db_restore
tar xzvf current.tar.gz
echo 'Stopping MySQL'
if [ -z "`service mysql stop | grep 'done'`" ] ; then
	echo "ERROR: Couldn't stop mysql daemon."
	exit 1
fi
rm -rf /mnt/mysql/old
mkdir -p /mnt/mysql/old
echo 'Moving Data/Log Directories to /old'
mv /mnt/mysql/data /mnt/mysql/log /mnt/mysql/old
mkdir /mnt/mysql/data /mnt/mysql/log
echo 'Copying back'
innobackupex --copy-back . 2> $LOGFILE
if [ -z "`tail -1 $LOGFILE | grep 'completed OK!'`" ] ; then
	echo "ERROR: Innobackupex couldn't copy back."
	exit 1
fi
chown -R mysql.mysql /mnt/mysql/data
chown -R mysql.mysql /mnt/mysql/log
echo 'Starting MySQL'
if [ -z "`service mysql start | grep 'done'`" ] ; then
	echo "ERROR: Couldn't start mysql daemon."
	exit 1
fi
echo 'Cleaning up'
rm -rf /mnt/mysql/old
rm -rf /mnt/db_restore
echo "Success."
exit 0

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
rubber-3.2.2 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-3.2.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-3.2.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-3.1.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-3.0.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-3.0.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.16.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.15.2 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.15.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.15.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.14.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.13.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.13.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.12.2 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.12.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.12.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.11.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.10.2 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.10.1 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh
rubber-2.10.0 templates/xtrabackup/config/rubber/role/db/rubber-xtrarestore.sh