Move the creation of the backup folders to before the attempt to create the log files because if the folder don't exist then no logs will be created on the first run.
This commit is contained in:
parent
b18c127e2a
commit
7b556dc7db
@ -261,28 +261,6 @@ LOGERR=${BACKUPDIR}/ERRORS_${DBHOST}-`${DATEC} +%N`.log # Logfile Name
|
||||
BACKUPFILES=""
|
||||
OPT="--quote-names --opt" # OPT string for use with mysqldump ( see man mysqldump )
|
||||
|
||||
# IO redirection for logging.
|
||||
touch ${LOGFILE}
|
||||
exec 6>&1 # Link file descriptor #6 with stdout.
|
||||
# Saves stdout.
|
||||
exec > ${LOGFILE} # stdout replaced with file ${LOGFILE}.
|
||||
touch ${LOGERR}
|
||||
exec 7>&2 # Link file descriptor #7 with stderr.
|
||||
# Saves stderr.
|
||||
exec 2> ${LOGERR} # stderr replaced with file ${LOGERR}.
|
||||
|
||||
# Add --compress mysqldump option to ${OPT}
|
||||
if [ "${COMMCOMP}" = "yes" ];
|
||||
then
|
||||
OPT="${OPT} --compress"
|
||||
fi
|
||||
|
||||
# Add --max_allowed_packet=... mysqldump option to ${OPT}
|
||||
if [ "${MAX_ALLOWED_PACKET}" ];
|
||||
then
|
||||
OPT="${OPT} --max_allowed_packet=${MAX_ALLOWED_PACKET}"
|
||||
fi
|
||||
|
||||
# Create required directories
|
||||
if [ ! -e "${BACKUPDIR}" ] # Check Backup Directory exists.
|
||||
then
|
||||
@ -314,6 +292,30 @@ eval ${RM} -fv "${BACKUPDIR}/latest/*"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# IO redirection for logging.
|
||||
touch ${LOGFILE}
|
||||
exec 6>&1 # Link file descriptor #6 with stdout.
|
||||
# Saves stdout.
|
||||
exec > ${LOGFILE} # stdout replaced with file ${LOGFILE}.
|
||||
touch ${LOGERR}
|
||||
exec 7>&2 # Link file descriptor #7 with stderr.
|
||||
# Saves stderr.
|
||||
exec 2> ${LOGERR} # stderr replaced with file ${LOGERR}.
|
||||
|
||||
|
||||
# Add --compress mysqldump option to ${OPT}
|
||||
if [ "${COMMCOMP}" = "yes" ];
|
||||
then
|
||||
OPT="${OPT} --compress"
|
||||
fi
|
||||
|
||||
# Add --max_allowed_packet=... mysqldump option to ${OPT}
|
||||
if [ "${MAX_ALLOWED_PACKET}" ];
|
||||
then
|
||||
OPT="${OPT} --max_allowed_packet=${MAX_ALLOWED_PACKET}"
|
||||
fi
|
||||
|
||||
# Functions
|
||||
|
||||
# Database dump function
|
||||
|
Loading…
x
Reference in New Issue
Block a user