usr/bin/custom/watchdog-monitor aktualisiert
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user