usr/bin/custom/watchdog-monitor aktualisiert
This commit is contained in:
@@ -28,7 +28,6 @@ update_watchdog_config() {
|
|||||||
# Set interval
|
# Set interval
|
||||||
echo "interval = 59" | sudo tee -a "$config_file" > /dev/null
|
echo "interval = 59" | sudo tee -a "$config_file" > /dev/null
|
||||||
|
|
||||||
|
|
||||||
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"
|
||||||
else
|
else
|
||||||
@@ -46,6 +45,8 @@ 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
|
||||||
@@ -54,7 +55,7 @@ end_time=$((start_time + 300)) # 5 minutes in seconds
|
|||||||
interval=30 # Initial interval of 30 seconds
|
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"
|
echo "No IP addresses found. Waiting for $interval seconds before checking again..." >> "$log_file"
|
||||||
else
|
else
|
||||||
echo "IP addresses found and watchdog restarted. Exiting loop." >> "$log_file"
|
echo "IP addresses found and watchdog restarted. Exiting loop." >> "$log_file"
|
||||||
|
|||||||
Reference in New Issue
Block a user