From af0b0c7bb14e5a1cce2a11d34bb5549e1108c5b0 Mon Sep 17 00:00:00 2001 From: Tim Eertmoed Date: Mon, 28 Oct 2024 19:29:33 +0100 Subject: [PATCH] usr/bin/custom/watchdog-monitor aktualisiert --- usr/bin/custom/watchdog-monitor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/bin/custom/watchdog-monitor b/usr/bin/custom/watchdog-monitor index dc1cc90..54361e9 100644 --- a/usr/bin/custom/watchdog-monitor +++ b/usr/bin/custom/watchdog-monitor @@ -30,6 +30,7 @@ update_watchdog_config() { if [ ${#ip_array[@]} -eq 0 ]; then echo "No IP addresses found. Watchdog configuration cleared." >> "$log_file" + return 0 # Indicate that no IP addresses were found else for ip in "${ip_array[@]}"; do echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null @@ -45,8 +46,6 @@ update_watchdog_config() { return 1 # Indicate that IP addresses were found fi - - return 0 # Indicate that no IP addresses were found } # Main loop @@ -56,6 +55,8 @@ interval=30 # Initial interval of 30 seconds while true; do if update_watchdog_config; then + echo "No IP addresses found. Waiting for $interval seconds before checking again..." >> "$log_file" + else echo "IP addresses found and watchdog restarted. Exiting loop." >> "$log_file" break # Exit the loop if IP addresses were found fi