BlueOnyx MySQL Backup Script

Overview

bo-backupmysql is a shell script that automatically backups the local MySQL server on a BlueOnyx Server or VPS. It is currently available for BlueOnyx 5106R and 5107R.

Quicklinx
BlueOnyx Homepage
BlueOnyx VPS Hosting
TeleMedia Publications
Download:
RPM (5106R) | PKG (5106R)
RPM (5107R) | PKG (5107R)
$Id: blueonyx-mysqlbackup.html,v 1.19 2015-05-01 16:48:58 obiwan Exp $

Features

Requirements

This script is specifically geared towards BlueOnyx servers, it won't work on any other platform. If you're running a recent version of BlueOnyx the package/script should work on all configurations. Just make sure you have at least the same amount of free space available on /home that your MySQL databases currently uses.

License

BSD

Disclaimer

This software is provided ``as is'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall SCS TeleMedia AG be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Installation

Installing the PKG (recommended)

Download the latest package from here and install it in the BlueOnyx Admin GUI:

  1. Login as user admin
  2. Navigate to Software Updates | Third Party Software
  3. Click Install Manually and either upload the previously downloaded PKG file or paste the URL

Once installed bo-backupmysql will send a nightly report to the admin user on your server. To receive the nightly email reports, make sure you either read the mail of user admin directly (i.e. POP3-client or webmail) or you have setup a forwarding under Personal Profile | Email.

Please note:

The PKG installs also the telemedia-blueonyx-repository for yum on the system so that you will automatically receive updates to the script. If you do not wish the telemedia-blueonyx-repository to be installed, use the RPM version of the script below and download updates from this page.

Installing the RPM

Download the latest RPM package from here and install it via

rpm -i telemedia-bo_backupmysql-1-X.XX.i386.rpm

 

Configuration

There is a sample config file at /etc/bo-backupmysql.conf with all settings explained. The configuration file will only be used if present and only the values that are not commented out with a #, else a few sane defaults will be used.

The possible settings in the config file are:


# Set the dateformat used for the filename of the dump:
#DATE=`date +%Y%m%d%H%M`
#
# Set the hostname if you dont want the value retrieved from the system at runtime:
#HOSTNAME=`hostname -f`
#
# Set the destination directory for backups
#BDIR=/home/backup
#
# Set the destination filename for the backups/dumps:
#FNAME=${BDIR}/${HOSTNAME}_${DATE}.backup.sql
#
# Set the maximum age in days for older backups/dumps in $BDIR:
#MAXAGE=20
#
# Set the process priority (nice) of the bo-backupmysql script 
# [see man nice/renice/ps for more information] :
#BENICE=10

 

Pre- and Post-Backup scripts

Since Version 1.26 it is also possible to include pre- and post-Backup scripts. Richard Morgan offered on the BlueOnyx mailinglist the following post-Backup script (/usr/local/sbin/bo-backupmysql.post) to upload the last MySQL Backup to an FTP server:


echo "-----";
echo "$FNAME.tar.gz will be sent to an FTP server";

FTP_HOST=nnn.nnn.nnn.nnn
FTP_USER=username
FTP_PASS=password
FTP_PATH=/database_backups

ncftpput -m -u $FTP_USER -p $FTP_PASS $FTP_HOST $FTP_PATH $FNAME.tar.gz
 
echo "$FNAME.tar.gz stored on $FTP_HOST at $FTP_PATH";
echo "-----";

Similary you could use scp to transfer the backup file, given you have setup keys for automatic login on the remote host:


echo "-----";
echo "$FNAME.tar.gz will be sent to an SSH server";

SCP_HOST=nnn.nnn.nnn.nnn
SCP_PATH=/database_backups
scp $FNAME.tar.gz $SCP_HOST:$SCP_PATH
 
echo "$FNAME.tar.gz stored on $SCP_HOST at $SCP_PATH";
echo "-----";

Another example could be to shutdown webservice before backup to make sure you have consistent export:

In /usr/local/sbin/bo-backupmysql.pre:


echo "-----";
echo "shutting down web service:"
echo "-----";
/etc/init.d/httpd stop

And in /usr/local/sbin/bo-backupmysql.post:


echo "-----";
echo "restarting web service:"
echo "-----";
/etc/init.d/httpd start

Feedback

We appreciate your feedback, please report any bugs, problems or wishes for enhancements through our feedbackform.

 

Changelog

1.16 [12.04.2010] Initial public release
1.19 [17.04.2010] Bugfixes (cronjob, pw-handling)
1.20 [24.04.2010] Bugfixes (purgejob, pw-handling)
1.21 [01.11.2010] Creates single files for each DB for easier restore
1.22 [17.02.2011] Added --skip-add-locks for easier restore in BlueOnyx
1.26 [26.05.2011] Added optional post- and pre-backup scripts (see the output for the location of the includes)
1.31 [6.11.2012] Version for 5107R, 5106R synced with 5107R

Visit our sponsors:
Werbung mit WebFusionClick