[-]
[+]
|
Changed |
automysqlbackup.spec
|
|
[-]
[+]
|
Changed |
automysqlbackup.sh.multihost_per_environment.patch
^
|
@@ -1,27 +1,36 @@
---- automysqlbackup.sh.2.5.orig 2009-05-23 17:58:36.000000000 +0200
-+++ automysqlbackup.sh.2.5 2009-05-23 18:00:01.000000000 +0200
+--- automysqlbackup.sh.2.5.orig 2009-06-26 14:18:40.000000000 +0200
++++ automysqlbackup.sh.2.5 2009-06-26 14:18:26.000000000 +0200
@@ -25,19 +25,19 @@
#=====================================================================
# Username to access the MySQL server e.g. dbuser
-USERNAME=dbuser
-+USERNAME:=dbuser
++USERNAME=`echo ${USERNAME:=dbuser}`
# Username to access the MySQL server e.g. password
-PASSWORD=password
-+PASSWORD:=password
++PASSWORD=`echo ${PASSWORD:=password}`
# Host name (or IP address) of MySQL server e.g localhost
-DBHOST=localhost
-+DBHOST:=localhost
++DBHOST=`echo ${DBHOST:=localhost}`
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
-DBNAMES="DB1 DB2 DB3"
-+DBNAMES:="DB1 DB2 DB3"
++DBNAMES=`echo ${DBNAMES:="DB1 DB2 DB3"}`
# Backup directory location e.g /backups
-BACKUPDIR="/backups"
-+BACKUPDIR:="/backups/${DBHOST}"
++BACKUPDIR=`echo ${BACKUPDIR:="/backup/mysql/${DBHOST}"}`
# Mail setup
# What would you like to be mailed to you?
+@@ -62,7 +62,7 @@
+ MDBNAMES="mysql $DBNAMES"
+
+ # List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes)
+-DBEXCLUDE=""
++DBEXCLUDE=`echo ${DBEXCLUDE:=""}`
+
+ # Include CREATE DATABASE in backup?
+ CREATE_DATABASE=yes
|
[-]
[+]
|
Changed |
multimysqlbackup.conf
^
|
@@ -2,8 +2,8 @@
# define hosts , access data and databases
#
# format:
-# host;user;password;databases_separated_by_spaces
+# host;user;password;databases_separated_by_spaces;exclude_databases
# samples:
-# localhost;root;;all
-# localhost;root;password;mysql my_first_database my_second_database
+# localhost;root;;all;
+# localhost;root;password;mysql my_first_database my_second_database;exclude1_db exclude2_db
|
[-]
[+]
|
Changed |
multimysqlbackup.sh
^
|
@@ -2,37 +2,35 @@
#
# Name: multimysqlbackup
# Summary: wrapper for automysqlbackup to backup multiple hosts
-# Version: 0.1
+# Version: 0.2
# Author: Carsten Schoene <cs@linux-administrator.com>
-# Last change: 23-05-2009
+# Last change: 26-06-2009
#
###############################################################################
# path to host,db definitions
-CONFPATH=/etc/multimysqlbackup.conf
+CONFPATH="/etc/multimysqlbackup.conf"
# path to mysql backup script
-AUTOMYSQLBACKUP=/usr/sbin/automysqlbackup
+AUTOMYSQLBACKUP="/usr/sbin/automysqlbackup"
# lock each job
LOCKJOB=1
###############################################################################
-if [ -s ${CONFPATH} ] ; then
+if [ -s "${CONFPATH}" ] ; then
- # set new IFS
- IFS="\t\n"
+ for LINE in `cat ${CONFPATH} | grep -v ^# | grep -v ^$ | sed -e s@" "@"%20%"@g` ; do
- for LINE in `cat ${CONFPATH} | grep -v ^#` ; do
-
- # format: host;user;password;databases_separated_by_spaces
+ # format: host;user;password;databases_separated_by_spaces;databases_to_exclude_separated_by_spaces
export DBHOST=`echo ${LINE} | awk -F\; '{print $1}'`
export USERNAME=`echo ${LINE} | awk -F\; '{print $2}'`
export PASSWORD=`echo ${LINE} | awk -F\; '{print $3}'`
- export DBNAMES=`echo ${LINE} | awk -F\; '{print $4}'`
+ export DBNAMES=`echo ${LINE} | awk -F\; '{print $4}'|sed -e s@"%20%"@" "@g`
+ export DBEXCLUDE=`echo ${LINE} | awk -F\; '{print $5}'|sed -e s@"%20%"@" "@g`
- if [ ! -f /var/lock/${DBHOST}.lock && "${LOCKJOB}" == "1" ] ; then
+ if [ ! -f /var/lock/${DBHOST}.lock ] && [ "${LOCKJOB}" == "1" ] ; then
touch /var/lock/${DBHOST}.lock
${AUTOMYSQLBACKUP}
|