Skip to content

Commit

Permalink
Fix stderr redirect to hhnet log
Browse files Browse the repository at this point in the history
Signed-off-by: Pau Capdevila <[email protected]>
  • Loading branch information
pau-hedgehog committed Feb 6, 2025
1 parent a6df71b commit a35acfe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/hhfab/hhnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit a35acfe

Please sign in to comment.