From 2ffb67cc35f6533b96ceff96616e8f5164c7a08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 8 Feb 2022 11:47:28 +0100 Subject: [PATCH] Redirect debug_message to temp log file --- proxmox/vzdump-hook-hardlink-latest.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/proxmox/vzdump-hook-hardlink-latest.sh b/proxmox/vzdump-hook-hardlink-latest.sh index de57e13..0ed3e3f 100755 --- a/proxmox/vzdump-hook-hardlink-latest.sh +++ b/proxmox/vzdump-hook-hardlink-latest.sh @@ -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 \