From 39ee07fe1403b9838994eff4f702204dfe4b935b Mon Sep 17 00:00:00 2001 From: Tim Eertmoed Date: Mon, 28 Oct 2024 19:48:27 +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 dc6c0a4..1d9ef72 100644 --- a/usr/bin/custom/watchdog-monitor +++ b/usr/bin/custom/watchdog-monitor @@ -28,7 +28,6 @@ update_watchdog_config() { # Set interval echo "interval = 59" | sudo tee -a "$config_file" > /dev/null - if [ ${#ip_array[@]} -eq 0 ]; then echo "No IP addresses found. Watchdog configuration cleared." >> "$log_file" else @@ -46,6 +45,8 @@ update_watchdog_config() { return 1 # Indicate that IP addresses were found fi + + return 0 # Indicate that no IP addresses were found } # Main loop @@ -54,7 +55,7 @@ end_time=$((start_time + 300)) # 5 minutes in seconds interval=30 # Initial interval of 30 seconds while true; do - if update_watchdog_config; then + 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"