stable #2
@@ -30,6 +30,7 @@ update_watchdog_config() {
|
|||||||
|
|
||||||
if [ ${#ip_array[@]} -eq 0 ]; then
|
if [ ${#ip_array[@]} -eq 0 ]; then
|
||||||
echo "No IP addresses found. Watchdog configuration cleared." >> "$log_file"
|
echo "No IP addresses found. Watchdog configuration cleared." >> "$log_file"
|
||||||
|
return 0 # Indicate that no IP addresses were found
|
||||||
else
|
else
|
||||||
for ip in "${ip_array[@]}"; do
|
for ip in "${ip_array[@]}"; do
|
||||||
echo "ping = $ip" | sudo tee -a "$config_file" > /dev/null
|
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
|
return 1 # Indicate that IP addresses were found
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0 # Indicate that no IP addresses were found
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main loop
|
# Main loop
|
||||||
@@ -56,6 +55,8 @@ interval=30 # Initial interval of 30 seconds
|
|||||||
|
|
||||||
while true; do
|
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"
|
echo "IP addresses found and watchdog restarted. Exiting loop." >> "$log_file"
|
||||||
break # Exit the loop if IP addresses were found
|
break # Exit the loop if IP addresses were found
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user