@@ -1,5 +1,5 @@
---- automysqlbackup-2.5.1-01.sh.orig 2011-01-23 14:58:59.906151366 +0100
-+++ automysqlbackup-2.5.1-01.sh 2011-01-23 17:58:06.919640733 +0100
+--- 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 ###
@@ -191,7 +191,7 @@
done
fi
-@@ -618,40 +690,119 @@
+@@ -618,40 +690,127 @@
DB="`${ECHO} ${DB} | ${SED} 's/%/ /g'`"
# Create Seperate directory for each DB
@@ -208,8 +208,7 @@
+ fi
+
+ if [ ! -e "${BACKUPDIR}/weekly/${DB}_pertable" ] # Check Weekly DB per table Directory exists.
- then
-- mkdir -p "${BACKUPDIR}/weekly/${DB}"
++ then
+ mkdir -p "${BACKUPDIR}/weekly/${DB}_pertable"
+ fi
+ else
@@ -219,7 +218,8 @@
+ fi
+
+ if [ ! -e "${BACKUPDIR}/weekly/${DB}" ] # Check Weekly DB Directory exists.
-+ then
+ then
+- mkdir -p "${BACKUPDIR}/weekly/${DB}"
+ mkdir -p "${BACKUPDIR}/weekly/${DB}"
+ fi
fi
@@ -237,6 +237,10 @@
- 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
@@ -290,6 +294,10 @@
- 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
@@ -331,7 +339,7 @@
${ECHO} ----------------------------------------------------------------------
fi
done
-@@ -665,6 +816,14 @@
+@@ -665,6 +824,14 @@
# Monthly Full Backup of all Databases
if [ ${DOM} = "01" ]; then
${ECHO} Monthly full Backup of \( ${MDBNAMES} \)...
@@ -346,7 +354,7 @@
dbdump "${MDBNAMES}" "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql"
[ $? -eq 0 ] && {
${ECHO} "Rotating 5 month backups."
-@@ -672,6 +831,7 @@
+@@ -672,6 +839,7 @@
}
compression "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql"
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql${SUFFIX}"
@@ -354,7 +362,7 @@
${ECHO} ----------------------------------------------------------------------
fi
-@@ -680,6 +840,14 @@
+@@ -680,6 +848,14 @@
${ECHO} Weekly Backup of Databases \( ${DBNAMES} \)
${ECHO}
${ECHO}
@@ -369,7 +377,7 @@
dbdump "${DBNAMES}" "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql"
[ $? -eq 0 ] && {
${ECHO} Rotating 5 weeks Backups...
-@@ -687,6 +855,7 @@
+@@ -687,6 +863,7 @@
}
compression "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql"
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/week.${W}.${DATE}.sql${SUFFIX}"
@@ -377,7 +385,7 @@
${ECHO} ----------------------------------------------------------------------
# Daily Backup
-@@ -694,6 +863,14 @@
+@@ -694,6 +871,14 @@
${ECHO} Daily Backup of Databases \( ${DBNAMES} \)
${ECHO}
${ECHO}
@@ -392,7 +400,7 @@
dbdump "${DBNAMES}" "${BACKUPDIR}/daily/${DATE}.${DOW}.sql"
[ $? -eq 0 ] && {
${ECHO} Rotating last weeks Backup...
-@@ -701,6 +878,7 @@
+@@ -701,6 +886,7 @@
}
compression "${BACKUPDIR}/daily/${DATE}.${DOW}.sql"
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DATE}.${DOW}.sql${SUFFIX}"
@@ -400,7 +408,7 @@
${ECHO} ----------------------------------------------------------------------
fi
${ECHO} Backup End Time `${DATEC}`
-@@ -745,21 +923,21 @@
+@@ -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
|