Redirect debug_message to temp log file
This commit is contained in:
parent
03c713d836
commit
2ffb67cc35
|
@ -44,9 +44,14 @@ HELP
|
|||
debug_message() { # {{{
|
||||
|
||||
local_debug_message="${1}"
|
||||
local_temp_log="/tmp/pve.log"
|
||||
|
||||
if [ ! -f "${local_temp_log}" ]; then
|
||||
true > "${local_temp_log}"
|
||||
fi
|
||||
|
||||
## Print message if DEBUG is enable (=0)
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG − ${PROGNAME} : ${local_debug_message}"
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG − ${PROGNAME} : ${local_debug_message}" >> "${local_temp_log}"
|
||||
|
||||
unset local_debug_message
|
||||
|
||||
|
@ -71,13 +76,15 @@ main() { # {{{
|
|||
ARGS=${ARGS}
|
||||
env=$(env)"
|
||||
|
||||
|
||||
# If backup is complete {{{
|
||||
if [ "${phase}" = "backup-end" ]; then
|
||||
## Get TARGET's file extension
|
||||
target_archive_extension="$(printf '%s' "${TARGET}" | sed -n "s/.*\.\([[:alnum:]]*\.[[:alnum:]]*\)$/\1/p")"
|
||||
## Set path for LATEST archive file
|
||||
latest_archive="${dumpdir}/vzdump-${vmtype}-${vmid}-latest.${target_archive_extension}"
|
||||
debug_message "backup-end − \
|
||||
target_archive_extension=${target_archive_extension}
|
||||
latest_archive=${latest_archive}"
|
||||
|
||||
## hardlink TARGET archive to LATEST
|
||||
debug_message "hardlink TARGET archive (${target_archive}) to \
|
||||
|
@ -90,6 +97,8 @@ LATEST (${latest_archive})."
|
|||
if [ "${phase}" = "log-end" ]; then
|
||||
## Set path for LATEST log file
|
||||
latest_log="${dumpdir}/vzdump-${vmtype}-${vmid}-latest.log"
|
||||
debug_message "log-end − \
|
||||
latest_log=${latest_log}"
|
||||
|
||||
## hardlink TARGET log to LATEST
|
||||
debug_message "hardlink TARGET logs (${logfile}) to \
|
||||
|
|
Loading…
Reference in New Issue