From a35acfe68b1fad97ffe101dbd20650a3d5df3ef2 Mon Sep 17 00:00:00 2001 From: Pau Capdevila Date: Thu, 6 Feb 2025 16:46:06 +0100 Subject: [PATCH] Fix stderr redirect to hhnet log Signed-off-by: Pau Capdevila --- pkg/hhfab/hhnet.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/hhfab/hhnet.sh b/pkg/hhfab/hhnet.sh index c1533a31..d6405ca2 100644 --- a/pkg/hhfab/hhnet.sh +++ b/pkg/hhfab/hhnet.sh @@ -10,10 +10,16 @@ readonly MAX_IP_ATTEMPTS=300 readonly VLAN_MIN=1 readonly VLAN_MAX=4094 +LOG_FILE="/var/log/hhnet.log" +touch "$LOG_FILE" +chmod 666 "$LOG_FILE" + +# Redirect stderr to log file +exec 2>>"$LOG_FILE" + if [[ "${DEBUG:-}" == "1" ]]; then - exec 3>&2 - exec 2>/tmp/hhnet.log - set -x + exec 3>&2 # Save stderr for debugging (FD 3) + set -x # Enable debug mode (command tracing) fi function log() {