Search
j0ke.net Open Build Service
>
Projects
>
server:backup
>
automysqlbackup
> automysqlbackup-2.5.1-patches_centos.diff
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File automysqlbackup-2.5.1-patches_centos.diff of Package automysqlbackup (Revision 13)
Currently displaying revision
13
,
show latest
--- 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" ]; + then + if [ ! -e "${BACKUPDIR}/daily/${DB}_pertable" ] # Check Daily DB per table Directory exists. then - mkdir -p "${BACKUPDIR}/daily/${DB}" - fi - - if [ ! -e "${BACKUPDIR}/weekly/${DB}" ] # Check Weekly DB Directory exists. + mkdir -p "${BACKUPDIR}/daily/${DB}_pertable" + fi + + if [ ! -e "${BACKUPDIR}/weekly/${DB}_pertable" ] # Check Weekly DB per table Directory exists. + then + mkdir -p "${BACKUPDIR}/weekly/${DB}_pertable" + fi + else + if [ ! -e "${BACKUPDIR}/daily/${DB}" ] # Check Daily DB Directory exists. + then + mkdir -p "${BACKUPDIR}/daily/${DB}" + fi + + if [ ! -e "${BACKUPDIR}/weekly/${DB}" ] # Check Weekly DB Directory exists. then - mkdir -p "${BACKUPDIR}/weekly/${DB}" + mkdir -p "${BACKUPDIR}/weekly/${DB}" + fi fi # Weekly Backup if [ ${DNOW} = ${DOWEEKLY} ]; then ${ECHO} Weekly Backup of Database \( ${DB} \) ${ECHO} - dbdump "${DB}" "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql" - [ $? -eq 0 ] && { - ${ECHO} Rotating 5 weeks Backups... - ${FIND} "${BACKUPDIR}/weekly/${DB}" -mtime +35 -type f -exec ${RM} -v {} \; - } - compression "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql" - BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql${SUFFIX}" + if [ "$PERTABLE" = "yes" ]; + then + if [ ! -e "$BACKUPDIR/weekly/${DB}_pertable/${DB}_pertable.week.$W.$DATE" ] # Check Weekly DB per table Directory exists. + then + mkdir -p "$BACKUPDIR/weekly/${DB}_pertable/${DB}_pertable.week.$W.$DATE" + fi + TABLES="`${MYSQL} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} --batch --skip-column-names -e "show tables" ${DB} | sed 's/ /%/g'`" + for TABLE in ${TABLES} + do + if [ "$PIPECOMP" = "yes" ]; then + dbdump_table_comp "${DB}" "${TABLE}" "${BACKUPDIR}/weekly/${DB}_pertable/${DB}_pertable.week.${W}.${DATE}/${TABLE}.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating 5 weeks Backups... + ${FIND} "${BACKUPDIR}/weekly/${DB}_pertable" -mtime +35 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}_pertable/${DB}_pertable.week.${W}.${DATE}/${TABLE}.sql${SUFFIX}" + else + dbdump_table "${DB}" "${TABLE}" "${BACKUPDIR}/weekly/${DB}_pertable/${DB}_pertable.week.${W}.${DATE}/${TABLE}.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating 5 weeks Backups... + ${FIND} "${BACKUPDIR}/weekly/${DB}_pertable" -mtime +35 -type f -exec ${RM} -v {} \; + } + compression "${BACKUPDIR}/weekly/${DB}_pertable/${DB}_pertable.week.${W}.${DATE}/${TABLE}.sql" + BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}_pertable/${DB}_pertable.week.${W}.${DATE}/${TABLE}.sql${SUFFIX}" + fi + done + else + if [ "$PIPECOMP" = "yes" ]; then + dbdump_comp "$DB" "$BACKUPDIR/weekly/$DB/${DB}_week.$W.$DATE.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating 5 weeks Backups... + ${FIND} "${BACKUPDIR}/weekly/${DB}" -mtime +35 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql${SUFFIX}" + else + dbdump "${DB}" "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating 5 weeks Backups... + ${FIND} "${BACKUPDIR}/weekly/${DB}" -mtime +35 -type f -exec ${RM} -v {} \; + } + compression "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql" + BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql${SUFFIX}" + fi + fi ${ECHO} ---------------------------------------------------------------------- # Daily Backup else ${ECHO} Daily Backup of Database \( ${DB} \) ${ECHO} - dbdump "${DB}" "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql" - [ $? -eq 0 ] && { - ${ECHO} Rotating last weeks Backup... - ${FIND} "${BACKUPDIR}/daily/${DB}" -mtime +6 -type f -exec ${RM} -v {} \; - } - compression "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql" - BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql${SUFFIX}" + if [ "$PERTABLE" = "yes" ]; + then + if [ ! -e "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW" ] # Check Daily DB per table Directory exists. + then + mkdir -p "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW" + fi + TABLES="`${MYSQL} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} --batch --skip-column-names -e "show tables" ${DB} | sed 's/ /%/g'`" + for TABLE in ${TABLES} + do + if [ "$PIPECOMP" = "yes" ]; then + dbdump_table_comp "$DB" "$TABLE" "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW/$TABLE.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating last weeks Backup... + ${FIND} "${BACKUPDIR}/daily/${DB}_pertable" -mtime +5 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="$BACKUPFILES $BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW/$TABLE.sql$SUFFIX" + else + dbdump_table "$DB" "$TABLE" "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW/$TABLE.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating last weeks Backup... + ${FIND} "${BACKUPDIR}/daily/${DB}_pertable" -mtime +5 -type f -exec ${RM} -v {} \; + } + compression "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW/$TABLE.sql" + BACKUPFILES="$BACKUPFILES $BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW/$TABLE.sql$SUFFIX" + fi + done + else + if [ "$PIPECOMP" = "yes" ]; then + dbdump_comp "$DB" "$BACKUPDIR/daily/$DB/${DB}_$DATE.$DOW.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating last weeks Backup... + ${FIND} "${BACKUPDIR}/daily/${DB}" -mtime +6 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="$BACKUPFILES $BACKUPDIR/daily/$DB/${DB}_$DATE.$DOW.sql$SUFFIX" + else + dbdump "${DB}" "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating last weeks Backup... + ${FIND} "${BACKUPDIR}/daily/${DB}" -mtime +6 -type f -exec ${RM} -v {} \; + } + compression "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql" + BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql${SUFFIX}" + fi + fi ${ECHO} ---------------------------------------------------------------------- fi done @@ -665,6 +824,14 @@ # Monthly Full Backup of all Databases if [ ${DOM} = "01" ]; then ${ECHO} Monthly full Backup of \( ${MDBNAMES} \)... + if [ "$PIPECOMP" = "yes" ]; then + dbdump_comp "$MDBNAMES" "$BACKUPDIR/monthly/$DATE.$M.all-databases.sql" + [ $? -eq 0 ] && { + ${ECHO} "Rotating 5 month backups." + ${FIND} "${BACKUPDIR}/monthly" -mtime +150 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="$BACKUPFILES $BACKUPDIR/monthly/$DATE.$M.all-databases.sql$SUFFIX" + else dbdump "${MDBNAMES}" "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql" [ $? -eq 0 ] && { ${ECHO} "Rotating 5 month backups." @@ -672,6 +839,7 @@ } compression "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql" BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql${SUFFIX}" + fi ${ECHO} ---------------------------------------------------------------------- fi @@ -680,6 +848,14 @@ ${ECHO} Weekly Backup of Databases \( ${DBNAMES} \) ${ECHO} ${ECHO} + if [ "$PIPECOMP" = "yes" ]; then + dbdump_comp "$DBNAMES" "$BACKUPDIR/weekly/week.$W.$DATE.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating 5 weeks Backups... + ${FIND} "${BACKUPDIR}/weekly/" -mtime +35 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="$BACKUPFILES $BACKUPDIR/weekly/week.$W.$DATE.sql$SUFFIX" + else dbdump "${DBNAMES}" "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql" [ $? -eq 0 ] && { ${ECHO} Rotating 5 weeks Backups... @@ -687,6 +863,7 @@ } compression "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql" BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/week.${W}.${DATE}.sql${SUFFIX}" + fi ${ECHO} ---------------------------------------------------------------------- # Daily Backup @@ -694,6 +871,14 @@ ${ECHO} Daily Backup of Databases \( ${DBNAMES} \) ${ECHO} ${ECHO} + if [ "$PIPECOMP" = "yes" ]; then + dbdump_comp "$DBNAMES" "$BACKUPDIR/daily/$DATE.$DOW.sql" + [ $? -eq 0 ] && { + ${ECHO} Rotating last weeks Backup... + ${FIND} "${BACKUPDIR}/daily" -mtime +6 -type f -exec ${RM} -v {} \; + } + BACKUPFILES="$BACKUPFILES $BACKUPDIR/daily/$DATE.$DOW.sql$SUFFIX" + else dbdump "${DBNAMES}" "${BACKUPDIR}/daily/${DATE}.${DOW}.sql" [ $? -eq 0 ] && { ${ECHO} Rotating last weeks Backup... @@ -701,6 +886,7 @@ } compression "${BACKUPDIR}/daily/${DATE}.${DOW}.sql" BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DATE}.${DOW}.sql${SUFFIX}" + fi ${ECHO} ---------------------------------------------------------------------- fi ${ECHO} Backup End Time `${DATEC}` @@ -745,21 +931,21 @@ BACKUPFILES=`${ECHO} "${BACKUPFILES}" | ${SED} -e "s# # -a #g"` #enable multiple attachments mutt -s "${ERRORNOTE} MySQL Backup Log and SQL Files for ${HOST} - ${DATE}" ${BACKUPFILES} ${MAILADDR} < ${LOGFILE} #send via mutt else - ${CAT} "${LOGFILE}" | mail -s "WARNING! - MySQL Backup exceeds set maximum attachment size on ${HOST} - ${DATE}" ${MAILADDR} + ${CAT} "${LOGFILE}" | nail -r ${FROMADDR} -s "WARNING! - MySQL Backup exceeds set maximum attachment size on ${HOST} - ${DATE}" ${MAILADDR} fi elif [ "${MAILCONTENT}" = "log" ] then - ${CAT} "${LOGFILE}" | mail -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR} + ${CAT} "${LOGFILE}" | nail -r ${FROMADDR} -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR} if [ -s "${LOGERR}" ] then - ${CAT} "${LOGERR}" | mail -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR} + ${CAT} "${LOGERR}" | nail -r ${FROMADDR} -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR} fi elif [ "${MAILCONTENT}" = "quiet" ] then if [ -s "${LOGERR}" ] then - ${CAT} "${LOGERR}" | mail -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR} - ${CAT} "${LOGFILE}" | mail -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR} + ${CAT} "${LOGERR}" | nail -r ${FROMADDR} -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR} + ${CAT} "${LOGFILE}" | nail -r ${FROMADDR} -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR} fi else if [ -s "${LOGERR}" ]