[-]
[+]
|
Changed |
automysqlbackup.spec
|
|
[-]
[+]
|
Deleted |
automysqlbackup-2.5.1-patches.diff
^
|
@@ -1,437 +0,0 @@
---- automysqlbackup-2.5.1-01.sh.orig 2011-01-23 20:19:08.121944594 +0100
-+++ automysqlbackup-2.5.1-01.sh 2011-01-23 20:23:29.453281536 +0100
-@@ -36,19 +36,19 @@
- # (copy a new version to its location) without the need for editing it.
- ### START CFG ###
- # Username to access the MySQL server e.g. dbuser
-- USERNAME=debian
-+ USERNAME=`echo ${USERNAME:=dbuser}`
-
- # Password to access the MySQL server e.g. password
-- PASSWORD=
-+ PASSWORD=`echo ${PASSWORD:=password}`
-
- # Host name (or IP address) of MySQL server e.g localhost
-- DBHOST=localhost
-+ DBHOST=`echo ${DBHOST:=localhost}`
-
- # List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
-- DBNAMES="all"
-+ DBNAMES=`echo ${DBNAMES:="DB1 DB2 DB3"}`
-
- # Backup directory location e.g /backups
-- BACKUPDIR="/srv/backup/db"
-+ BACKUPDIR=`echo ${BACKUPDIR:="/backup/mysql/${DBHOST}"}`
-
- # Mail setup
- # What would you like to be mailed to you?
-@@ -64,6 +64,8 @@
- # Email Address to send mail to? (user@domain.com)
- MAILADDR="maintenance@example.com"
-
-+ # Email Address to send mail from? (root@host.tld)
-+ FROMADDR="automysqlbackup@`hostname -f`"
-
- # ============================================================
- # === ADVANCED OPTIONS ( Read the doc's below for details )===
-@@ -73,10 +75,10 @@
- MDBNAMES="${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=no
-+ CREATE_DATABASE=yes
-
- # Separate backup directory and file for each DB? (yes or no)
- SEPDIR=yes
-@@ -85,8 +87,11 @@
- DOWEEKLY=6
-
- # Choose Compression type. (gzip or bzip2)
-- COMP=gzip
--
-+ COMP=bzip2
-+
-+ # Use pipe compress
-+ PIPECOMP=yes
-+
- # Compress communications between backup server and MySQL server?
- COMMCOMP=no
-
-@@ -98,7 +103,10 @@
-
- # For connections to localhost. Sometimes the Unix socket file must be specified.
- SOCKET=
--
-+
-+ # Backup databases per table work if SEPDIR set to `yes'
-+ PERTABLE=yes
-+
- # Command to run before backups (uncomment to use)
- #PREBACKUP="/etc/mysql-backup-pre"
-
-@@ -508,13 +516,51 @@
- return $?
- }
-
-+dbdump_comp () {
-+if [ "$COMP" = "gzip" ]; then
-+ ${ECHO} Backup Information for "${1}.gz"
-+ SUFFIX=".gz"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${GZIP} > ${2}${SUFFIX}
-+ ${GZIP} -l "$1.gz"
-+elif [ "$COMP" = "bzip2" ]; then
-+ ${ECHO} Compression information for "${1}.bz2"
-+ SUFFIX=".bz2"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${BZIP2} -v 2>&1 > ${2}${SUFFIX}
-+else
-+ ${ECHO} "No compression option set, check advanced settings"
-+fi
-+return $?
-+}
-+
-+dbdump_table () {
-+${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} > ${3}
-+return $?
-+}
-+
-+dbdump_table_comp () {
-+if [ "${COMP}" = "gzip" ]; then
-+ echo
-+ echo Backup Information for "$3.gz"
-+ SUFFIX=".gz"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${GZIP} > ${3}${SUFFIX}
-+ ${GZIP} -l "${3}.gz"
-+elif [ "${COMP}" = "bzip2" ]; then
-+ echo Compression information for "${3}.bz2"
-+ SUFFIX=".bz2"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${BZIP2} -v 2>&1 > ${3}${SUFFIX}
-+else
-+ echo "No compression option set, check advanced settings"
-+fi
-+return $?
-+}
-+
- # Compression function plus latest copy
- SUFFIX=""
- compression () {
- if [ "${COMP}" = "gzip" ]; then
- ${GZIP} -f "${1}"
- ${ECHO}
-- ${ECHO} Backup Information for "${1}"
-+ ${ECHO} Backup Information for "${1}.gz"
- ${GZIP} -l "${1}.gz"
- SUFFIX=".gz"
- elif [ "${COMP}" = "bzip2" ]; then
-@@ -547,6 +593,8 @@
- if [ "${SEPDIR}" = "yes" ]; then # Check if CREATE DATABSE should be included in Dump
- if [ "${CREATE_DATABASE}" = "no" ]; then
- OPT="${OPT} --no-create-db"
-+ elif [ "${PERTABLE}" = "yes" ]; then
-+ OPT="${OPT} --no-create-db"
- else
- OPT="${OPT} --databases"
- fi
-@@ -596,19 +644,43 @@
- # Prepare ${DB} for using
- MDB="`${ECHO} ${MDB} | ${SED} 's/%/ /g'`"
-
-- if [ ! -e "${BACKUPDIR}/monthly/${MDB}" ] # Check Monthly DB Directory exists.
-- then
-- mkdir -p "${BACKUPDIR}/monthly/${MDB}"
-+ if [ "${PERTABLE}" = "yes" ]; # Check backup per table
-+ then # Start Monthly DB backup per table
-+ echo Monthly Backup of ${MDB} per table...
-+ TABLES="`${MYSQL} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} --batch --skip-column-names -e "show tables" ${MDB} | sed 's/ /%/g'`"
-+ for TABLE in $TABLES
-+ do
-+ if [ ! -e "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}" ] # Check Monthly DB per table Directory exists.
-+ then
-+ mkdir -p "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}"
-+ fi
-+ if [ "${PIPECOMP}" = "yes" ]; then
-+ dbdump_table_comp "${MDB}" "${TABLE}" "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql${SUFFIX}"
-+ else
-+ dbdump_table "${MDB}" "${TABLE}" "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ compression "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql${SUFFIX}"
-+ fi
-+ done
-+ echo ----------------------------------------------------------------------
-+ else # Start Monthly DB full
-+ if [ ! -e "${BACKUPDIR}/monthly/${MDB}" ] # Check Monthly DB Directory exists.
-+ then
-+ mkdir -p "${BACKUPDIR}/monthly/${MDB}"
-+ fi
-+
-+ echo Monthly Backup of ${MDB}...
-+ if [ "${PIPECOMP}" = "yes" ]; then
-+ dbdump_comp "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-+ else
-+ dbdump "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ compression "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-+ fi
-+ echo ----------------------------------------------------------------------
- fi
-- ${ECHO} Monthly Backup of ${MDB}...
-- dbdump "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-- [ $? -eq 0 ] && {
-- ${ECHO} "Rotating 5 month backups for ${MDB}"
-- ${FIND} "${BACKUPDIR}/monthly/${MDB}" -mtime +150 -type f -exec ${RM} -v {} \;
-- }
-- compression "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-- BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-- ${ECHO} ----------------------------------------------------------------------
- done
- fi
-
-@@ -618,40 +690,127 @@
- DB="`${ECHO} ${DB} | ${SED} 's/%/ /g'`"
-
- # Create Seperate directory for each DB
-- if [ ! -e "${BACKUPDIR}/daily/${DB}" ] # Check Daily DB Directory exists.
-+ if [ "${PERTABLE}" = "yes" ];
|
[-]
[+]
|
Deleted |
automysqlbackup-2.5.1-patches_centos.diff
^
|
@@ -1,437 +0,0 @@
---- automysqlbackup-2.5.1-01.sh.orig 2011-01-23 20:19:08.121944594 +0100
-+++ automysqlbackup-2.5.1-01.sh 2011-01-23 20:23:29.453281536 +0100
-@@ -36,19 +36,19 @@
- # (copy a new version to its location) without the need for editing it.
- ### START CFG ###
- # Username to access the MySQL server e.g. dbuser
-- USERNAME=debian
-+ USERNAME=`echo ${USERNAME:=dbuser}`
-
- # Password to access the MySQL server e.g. password
-- PASSWORD=
-+ PASSWORD=`echo ${PASSWORD:=password}`
-
- # Host name (or IP address) of MySQL server e.g localhost
-- DBHOST=localhost
-+ DBHOST=`echo ${DBHOST:=localhost}`
-
- # List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
-- DBNAMES="all"
-+ DBNAMES=`echo ${DBNAMES:="DB1 DB2 DB3"}`
-
- # Backup directory location e.g /backups
-- BACKUPDIR="/srv/backup/db"
-+ BACKUPDIR=`echo ${BACKUPDIR:="/backup/mysql/${DBHOST}"}`
-
- # Mail setup
- # What would you like to be mailed to you?
-@@ -64,6 +64,8 @@
- # Email Address to send mail to? (user@domain.com)
- MAILADDR="maintenance@example.com"
-
-+ # Email Address to send mail from? (root@host.tld)
-+ FROMADDR="automysqlbackup@`hostname -f`"
-
- # ============================================================
- # === ADVANCED OPTIONS ( Read the doc's below for details )===
-@@ -73,10 +75,10 @@
- MDBNAMES="${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=no
-+ CREATE_DATABASE=yes
-
- # Separate backup directory and file for each DB? (yes or no)
- SEPDIR=yes
-@@ -85,8 +87,11 @@
- DOWEEKLY=6
-
- # Choose Compression type. (gzip or bzip2)
-- COMP=gzip
--
-+ COMP=bzip2
-+
-+ # Use pipe compress
-+ PIPECOMP=yes
-+
- # Compress communications between backup server and MySQL server?
- COMMCOMP=no
-
-@@ -98,7 +103,10 @@
-
- # For connections to localhost. Sometimes the Unix socket file must be specified.
- SOCKET=
--
-+
-+ # Backup databases per table work if SEPDIR set to `yes'
-+ PERTABLE=yes
-+
- # Command to run before backups (uncomment to use)
- #PREBACKUP="/etc/mysql-backup-pre"
-
-@@ -508,13 +516,51 @@
- return $?
- }
-
-+dbdump_comp () {
-+if [ "$COMP" = "gzip" ]; then
-+ ${ECHO} Backup Information for "${1}.gz"
-+ SUFFIX=".gz"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${GZIP} > ${2}${SUFFIX}
-+ ${GZIP} -l "$1.gz"
-+elif [ "$COMP" = "bzip2" ]; then
-+ ${ECHO} Compression information for "${1}.bz2"
-+ SUFFIX=".bz2"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${BZIP2} -v 2>&1 > ${2}${SUFFIX}
-+else
-+ ${ECHO} "No compression option set, check advanced settings"
-+fi
-+return $?
-+}
-+
-+dbdump_table () {
-+${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} > ${3}
-+return $?
-+}
-+
-+dbdump_table_comp () {
-+if [ "${COMP}" = "gzip" ]; then
-+ echo
-+ echo Backup Information for "$3.gz"
-+ SUFFIX=".gz"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${GZIP} > ${3}${SUFFIX}
-+ ${GZIP} -l "${3}.gz"
-+elif [ "${COMP}" = "bzip2" ]; then
-+ echo Compression information for "${3}.bz2"
-+ SUFFIX=".bz2"
-+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${BZIP2} -v 2>&1 > ${3}${SUFFIX}
-+else
-+ echo "No compression option set, check advanced settings"
-+fi
-+return $?
-+}
-+
- # Compression function plus latest copy
- SUFFIX=""
- compression () {
- if [ "${COMP}" = "gzip" ]; then
- ${GZIP} -f "${1}"
- ${ECHO}
-- ${ECHO} Backup Information for "${1}"
-+ ${ECHO} Backup Information for "${1}.gz"
- ${GZIP} -l "${1}.gz"
- SUFFIX=".gz"
- elif [ "${COMP}" = "bzip2" ]; then
-@@ -547,6 +593,8 @@
- if [ "${SEPDIR}" = "yes" ]; then # Check if CREATE DATABSE should be included in Dump
- if [ "${CREATE_DATABASE}" = "no" ]; then
- OPT="${OPT} --no-create-db"
-+ elif [ "${PERTABLE}" = "yes" ]; then
-+ OPT="${OPT} --no-create-db"
- else
- OPT="${OPT} --databases"
- fi
-@@ -596,19 +644,43 @@
- # Prepare ${DB} for using
- MDB="`${ECHO} ${MDB} | ${SED} 's/%/ /g'`"
-
-- if [ ! -e "${BACKUPDIR}/monthly/${MDB}" ] # Check Monthly DB Directory exists.
-- then
-- mkdir -p "${BACKUPDIR}/monthly/${MDB}"
-+ if [ "${PERTABLE}" = "yes" ]; # Check backup per table
-+ then # Start Monthly DB backup per table
-+ echo Monthly Backup of ${MDB} per table...
-+ TABLES="`${MYSQL} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} --batch --skip-column-names -e "show tables" ${MDB} | sed 's/ /%/g'`"
-+ for TABLE in $TABLES
-+ do
-+ if [ ! -e "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}" ] # Check Monthly DB per table Directory exists.
-+ then
-+ mkdir -p "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}"
-+ fi
-+ if [ "${PIPECOMP}" = "yes" ]; then
-+ dbdump_table_comp "${MDB}" "${TABLE}" "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql${SUFFIX}"
-+ else
-+ dbdump_table "${MDB}" "${TABLE}" "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ compression "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}/${TABLE}.sql${SUFFIX}"
-+ fi
-+ done
-+ echo ----------------------------------------------------------------------
-+ else # Start Monthly DB full
-+ if [ ! -e "${BACKUPDIR}/monthly/${MDB}" ] # Check Monthly DB Directory exists.
-+ then
-+ mkdir -p "${BACKUPDIR}/monthly/${MDB}"
-+ fi
-+
-+ echo Monthly Backup of ${MDB}...
-+ if [ "${PIPECOMP}" = "yes" ]; then
-+ dbdump_comp "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-+ else
-+ dbdump "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ compression "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-+ BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-+ fi
-+ echo ----------------------------------------------------------------------
- fi
-- ${ECHO} Monthly Backup of ${MDB}...
-- dbdump "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-- [ $? -eq 0 ] && {
-- ${ECHO} "Rotating 5 month backups for ${MDB}"
-- ${FIND} "${BACKUPDIR}/monthly/${MDB}" -mtime +150 -type f -exec ${RM} -v {} \;
-- }
-- compression "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
-- BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
-- ${ECHO} ----------------------------------------------------------------------
- done
- fi
-
-@@ -618,40 +690,127 @@
- DB="`${ECHO} ${DB} | ${SED} 's/%/ /g'`"
-
- # Create Seperate directory for each DB
-- if [ ! -e "${BACKUPDIR}/daily/${DB}" ] # Check Daily DB Directory exists.
-+ if [ "${PERTABLE}" = "yes" ];
|
[-]
[+]
|
Changed |
automysqlbackup-2.6.4.sh
^
|
@@ -36,19 +36,19 @@
# (copy a new version to its location) without the need for editing it.
### START CFG ###
# Username to access the MySQL server e.g. dbuser
- USERNAME=debian
+ USERNAME=`echo ${USERNAME:=dbuser}`
# Password to access the MySQL server e.g. password
- PASSWORD=
+ PASSWORD=`echo ${PASSWORD:=password}`
# Host name (or IP address) of MySQL server e.g localhost
- DBHOST=localhost
+ DBHOST=`echo ${DBHOST:=localhost}`
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
- DBNAMES="all"
+ DBNAMES=`echo ${DBNAMES:="DB1 DB2 DB3"}`
# Backup directory location e.g /backups
- BACKUPDIR="/srv/backup/db"
+ BACKUPDIR=`echo ${BACKUPDIR:="/backup/mysql/${DBHOST}"}`
# Mail setup
# What would you like to be mailed to you?
@@ -56,14 +56,16 @@
# - files : send log file and sql files as attachments (see docs)
# - stdout : will simply output the log to the screen if run manually.
# - quiet : Only send logs if an error occurs to the MAILADDR.
- MAILCONTENT="log"
+ MAILCONTENT="quiet"
# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
MAXATTSIZE="4000"
# Email Address to send mail to? (user@domain.com)
- MAILADDR="maintenance@example.com"
+ MAILADDR=`echo ${MAILADDR:="maintenance@example.com"}`
+ # Email Address to send mail from? (root@host.tld)
+ FROMADDR="automysqlbackup@`hostname -f`"
# ============================================================
# === ADVANCED OPTIONS ( Read the doc's below for details )===
@@ -73,10 +75,13 @@
MDBNAMES="${DBNAMES}"
# List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes)
- DBEXCLUDE=""
+ DBEXCLUDE=`echo ${DBEXCLUDE:=""}`
+ # List of tables to exclude. Space-separated, with db name, e.g. "db1.table1 d2.table2"
+ TABLEEXCLUDE=`echo ${TABLEEXCLUDE:=""}`
+
# Include CREATE DATABASE in backup?
- CREATE_DATABASE=no
+ CREATE_DATABASE=yes
# Separate backup directory and file for each DB? (yes or no)
SEPDIR=yes
@@ -85,8 +90,11 @@
DOWEEKLY=6
# Choose Compression type. (gzip or bzip2)
- COMP=gzip
-
+ COMP=bzip2
+
+ # Use pipe compress
+ PIPECOMP=yes
+
# Compress communications between backup server and MySQL server?
COMMCOMP=no
@@ -98,7 +106,10 @@
# For connections to localhost. Sometimes the Unix socket file must be specified.
SOCKET=
-
+
+ # Backup databases per table work if SEPDIR set to `yes'
+ PERTABLE=yes
+
# Command to run before backups (uncomment to use)
#PREBACKUP="/etc/mysql-backup-pre"
@@ -261,7 +272,12 @@
#=====================================================================
# Change Log
#=====================================================================
-#
+# VER 2.6.4 - (2011-07-03)
+# - per table excludes
+# - mail command detection (option -r)
+# - --single-transaction & --routines options added
+# VER 2.6.3
+# - per table & bzip2 support
# VER 2.5.1-01 - (2010-07-06)
# - Fixed pathname bug item #3025849 (by Johannes Kolter)
# VER 2.5.1 - (2010-07-04)
@@ -395,7 +411,23 @@
HOSTNAMEC="`${WHICH} hostname`"
SED="`${WHICH} sed`"
GREP="`${WHICH} grep`"
+NAIL="`${WHICH} nail`"
+MAIL="`${WHICH} mail`"
+if [ -z "${NAIL}" ] ; then
+ if [ -n "${MAIL}" ] ; then
+ if [ -n "`${MAIL} -r 2>&1 | grep \"invalid option -- r\"`" ] ; then
+ # mail doesn't support -r
+ echo "No working 'mail' command found"
+ echo "Install nail which support -r option!"
+ exit 1
+ else
+ MAILCMD=${MAIL}
+ fi
+ fi
+else
+ MAILCMD=${NAIL}
+fi
function get_debian_pw() {
if [ -r /etc/mysql/debian.cnf ]; then
eval $(${AWK} '
@@ -441,11 +473,11 @@
DOM=`${DATEC} +%d` # Date of the Month e.g. 27
M=`${DATEC} +%B` # Month e.g January
W=`${DATEC} +%V` # Week Number e.g 37
-VER=2.5.1 # Version Number
+VER=2.6.4 # Version Number
LOGFILE=${BACKUPDIR}/${DBHOST}-`${DATEC} +%N`.log # Logfile Name
LOGERR=${BACKUPDIR}/ERRORS_${DBHOST}-`${DATEC} +%N`.log # Logfile Name
BACKUPFILES=""
-OPT="--quote-names --opt" # OPT string for use with mysqldump ( see man mysqldump )
+OPT="--quote-names --opt --single-transaction --routines" # OPT string for use with mysqldump ( see man mysqldump )
# IO redirection for logging.
touch ${LOGFILE}
@@ -508,13 +540,57 @@
return $?
}
+dbdump_comp () {
+if [ "$COMP" = "gzip" ]; then
+ ${ECHO} Backup Information for "${1}.gz"
+ SUFFIX=".gz"
+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${GZIP} > ${2}${SUFFIX}
+ ${GZIP} -l "$1.gz"
+elif [ "$COMP" = "bzip2" ]; then
+ ${ECHO} Compression information for "${1}.bz2"
+ SUFFIX=".bz2"
+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} | ${BZIP2} -v 2>&1 > ${2}${SUFFIX}
+else
+ ${ECHO} "No compression option set, check advanced settings"
+fi
+return $?
+}
+
+dbdump_table () {
+if [ -n "`echo ${TABLEEXCLUDE} | grep \"${1}.${2}\"`" ] ; then
+ OPT=`echo ${OPT} | ${SED} -e 's@ --opt @ --skip-opt @'`
+fi
+${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} > ${3}
+return $?
+}
+
+dbdump_table_comp () {
+if [ -n "`echo ${TABLEEXCLUDE} | grep \"${1}.${2}\"`" ] ; then
+ OPT=`echo ${OPT} | ${SED} -e 's@ --opt @ --skip-opt @'`
+fi
+if [ "${COMP}" = "gzip" ]; then
+ echo
+ echo Backup Information for "$3.gz"
+ SUFFIX=".gz"
+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${GZIP} > ${3}${SUFFIX}
+ ${GZIP} -l "${3}.gz"
+elif [ "${COMP}" = "bzip2" ]; then
+ echo Compression information for "${3}.bz2"
+ SUFFIX=".bz2"
+ ${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} ${2} | ${BZIP2} -v 2>&1 > ${3}${SUFFIX}
+else
+ echo "No compression option set, check advanced settings"
+fi
+return $?
+}
+
# Compression function plus latest copy
SUFFIX=""
compression () {
if [ "${COMP}" = "gzip" ]; then
${GZIP} -f "${1}"
${ECHO}
- ${ECHO} Backup Information for "${1}"
+ ${ECHO} Backup Information for "${1}.gz"
${GZIP} -l "${1}.gz"
SUFFIX=".gz"
elif [ "${COMP}" = "bzip2" ]; then
@@ -547,6 +623,8 @@
if [ "${SEPDIR}" = "yes" ]; then # Check if CREATE DATABSE should be included in Dump
if [ "${CREATE_DATABASE}" = "no" ]; then
|
[-]
[+]
|
Changed |
multimysqlbackup.conf
^
|
@@ -2,8 +2,8 @@
# define hosts , access data and databases
#
# format:
-# host;user;password;databases_separated_by_spaces;exclude_databases
+# host;user;password;databases_separated_by_spaces;exclude_databases;exclude_tables
# samples:
# localhost;root;;all;
-# localhost;root;password;mysql my_first_database my_second_database;exclude1_db exclude2_db
+# localhost;root;password;mysql my_first_database my_second_database;exclude1_db exclude2_db;exclude3_db.exclude_table1 exclude4_db.exclude_table2
|
[-]
[+]
|
Changed |
multimysqlbackup.sh
^
|
@@ -16,19 +16,19 @@
# lock each job
LOCKJOB=1
-
###############################################################################
if [ -s "${CONFPATH}" ] ; then
for LINE in `cat ${CONFPATH} | grep -v ^# | grep -v ^$ | sed -e s@" "@"%20%"@g` ; do
- # format: host;user;password;databases_separated_by_spaces;databases_to_exclude_separated_by_spaces
+ # format: host;user;password;databases_separated_by_spaces;databases_to_exclude_separated_by_spaces;tables_to_exclude
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}'|sed -e s@"%20%"@" "@g`
export DBEXCLUDE=`echo ${LINE} | awk -F\; '{print $5}'|sed -e s@"%20%"@" "@g`
+ export TABLEEXCLUDE=`echo ${LINE} | awk -F\; '{print $6}'|sed -e s@"%20%"@" "@g`
if [ ! -f /var/lock/${DBHOST}.lock ] && [ "${LOCKJOB}" == "1" ] ; then
|