stable #2
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user