From bd12ee9e496d9ecf8bb9a24216497ef4bacfb03d Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Fri, 20 Mar 2026 09:06:21 +0700 Subject: [PATCH] update --- check_and_reboot_state.json | 2 +- check_router_reboot.jl | 133 ++++++++++++----------- check_router_reboot_log.txt | 211 +++++++++++++++++++----------------- test_ping_result.json | 1 + 4 files changed, 179 insertions(+), 168 deletions(-) create mode 100644 test_ping_result.json diff --git a/check_and_reboot_state.json b/check_and_reboot_state.json index 47e31a2..79e011e 100644 --- a/check_and_reboot_state.json +++ b/check_and_reboot_state.json @@ -1 +1 @@ -{"last_reboot_datetime":"2026-03-19T18:27:53.682","consecutive_fails":0} \ No newline at end of file +{"last_reboot_datetime":"2026-03-20T08:56:37.673","consecutive_fails":0} \ No newline at end of file diff --git a/check_router_reboot.jl b/check_router_reboot.jl index 4c65d9f..a342f77 100644 --- a/check_router_reboot.jl +++ b/check_router_reboot.jl @@ -16,11 +16,11 @@ using Dates, Printf, JSON # Configuration const ROUTER_IP = "192.168.88.1" const TIMEOUT_SECS = 30 # request timeout -const ATTEMPTS_PER_CHECK = 3 # number of ping attempts per check -const BACKOFF_BETWEEN_ATTEMPTS = 60 # seconds between attempts +const ATTEMPTS_PER_CHECK = 1 # number of ping attempts per check +const BACKOFF_BETWEEN_ATTEMPTS = 1 # seconds between ping attempts const FAILS_TO_REBOOT = 3 # consecutive failed checks required to trigger reboot const COOLDOWN_AFTER_REBOOT_SECS = 600 # do not reboot again within this many seconds -const DRY_RUN = true # set false to actually reboot +const DRY_RUN = false # set false to actually reboot const CHECK_INTERVAL_SECS = 60 # run a check every CHECK_INTERVAL_SECS seconds const thisFolderPath = @__DIR__ @@ -226,77 +226,45 @@ end # Single check iteration function perform_check!(st::State) - # Check if we're in cooldown period - in_cooldown = false - if st.last_reboot_datetime !== nothing - timepass = ((Dates.now() - st.last_reboot_datetime).value / 1000) |> floor |> Int - if timepass < COOLDOWN_AFTER_REBOOT_SECS - in_cooldown = true + success = false + last_result = nothing + for i in 1:ATTEMPTS_PER_CHECK + ok, result = check_router_once(ROUTER_IP) + # ok, result = values(JSON.parsefile("test_ping_result.json")) # for testing without actual ping + if ok + success = true + break end - end + sleep(BACKOFF_BETWEEN_ATTEMPTS) + end + routerresult = isnothing(last_result) ? "no response" : last_result - success = false - last_result = nothing - for i in 1:ATTEMPTS_PER_CHECK - ok, result = check_router_once(ROUTER_IP) - last_result = result - if ok - success = true - break - end - sleep(BACKOFF_BETWEEN_ATTEMPTS) - end + # Check if we're in cooldown period + in_cooldown = false + if st.last_reboot_datetime !== nothing + timepass = ((Dates.now() - st.last_reboot_datetime).value / 1000) |> floor |> Int - if in_cooldown - # During cooldown, track failures but don't trigger reboot yet - if success - logmsg("$ROUTER_IP is reachable during cooldown. Router is back online! Resetting state.") - st.consecutive_fails = 0 - save_state(st, StateFilePath) - else - st.consecutive_fails += 1 - routerresult = isnothing(last_result) ? "no response" : last_result - logmsg("$ROUTER_IP is unreachable during cooldown. Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.") - save_state(st, StateFilePath) - - # Check if we've reached threshold by now - if st.consecutive_fails >= FAILS_TO_REBOOT - logmsg("Cooldown has expired and router is still unreachable. Triggering reboot.") - ok = do_reboot() - if ok - thisFilePath = @__FILE__ - broadcast_msg("Broadcasting from file: $thisFilePath") - logmsg("Reboot executed (or simulated). Resetting failure counter.") - st.consecutive_fails = 0 - st.last_reboot_datetime = Dates.now() - save_state(st, StateFilePath) - else - logmsg("Reboot attempt failed; will retry after next interval.") - end - end - end - return + if timepass < COOLDOWN_AFTER_REBOOT_SECS + in_cooldown = true end + end - # Outside cooldown - full check with potential reboot + if in_cooldown + # During cooldown, track failures but don't trigger reboot yet if success - if st.consecutive_fails > 0 - logmsg("$ROUTER_IP is reachable; resetting consecutive failure counter.") - else - # logmsg("$ROUTER_IP is reachable.") - end - st.consecutive_fails = 0 - save_state(st, StateFilePath) - return + logmsg("$ROUTER_IP is reachable during cooldown. Router is back online! Resetting state.") + st.consecutive_fails = 0 + save_state(st, StateFilePath) else - st.consecutive_fails += 1 - routerresult = isnothing(last_result) ? "no response" : last_result - logmsg("$ROUTER_IP is unreachable (last result: $routerresult). Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.") - save_state(st, StateFilePath) - end - if st.consecutive_fails >= FAILS_TO_REBOOT - save_state(st, StateFilePath) + st.consecutive_fails += 1 + + logmsg("$ROUTER_IP is unreachable during cooldown. Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.") + save_state(st, StateFilePath) + + # Check if we've reached threshold by now + if st.consecutive_fails >= FAILS_TO_REBOOT + logmsg("Cooldown has expired and router is still unreachable. Triggering reboot.") ok = do_reboot() if ok thisFilePath = @__FILE__ @@ -308,7 +276,40 @@ function perform_check!(st::State) else logmsg("Reboot attempt failed; will retry after next interval.") end + end end + return + end + + # Outside cooldown - full check with potential reboot + if success + if st.consecutive_fails > 0 + logmsg("$ROUTER_IP is reachable; resetting consecutive failure counter.") + else + # logmsg("$ROUTER_IP is reachable.") + end + st.consecutive_fails = 0 + save_state(st, StateFilePath) + return + else + st.consecutive_fails += 1 + logmsg("$ROUTER_IP is unreachable (last result: $routerresult). Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.") + save_state(st, StateFilePath) + end + if st.consecutive_fails >= FAILS_TO_REBOOT + save_state(st, StateFilePath) + ok = do_reboot() + if ok + thisFilePath = @__FILE__ + broadcast_msg("Broadcasting from file: $thisFilePath") + logmsg("Reboot executed (or simulated). Resetting failure counter.") + st.consecutive_fails = 0 + st.last_reboot_datetime = Dates.now() + save_state(st, StateFilePath) + else + logmsg("Reboot attempt failed; will retry after next interval.") + end + end end diff --git a/check_router_reboot_log.txt b/check_router_reboot_log.txt index 9b3a667..5cd362a 100644 --- a/check_router_reboot_log.txt +++ b/check_router_reboot_log.txt @@ -1,101 +1,110 @@ -[2026-03-11T16:30:28.572] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-11T16:43:50.213] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-11T17:37:15.954] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-11T20:38:46.720] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-11T20:50:40.732] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-12T18:00:51.749] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-18T15:31:58.643] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T15:08:25.431] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 1/3. -[2026-03-19T15:12:34.906] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 2/3. -[2026-03-19T15:16:44.259] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 3/3. -[2026-03-19T15:16:44.266] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:16:44.304] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:16:44.305] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:20:53.852] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 4/3. -[2026-03-19T15:20:53.853] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:20:53.853] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:20:53.853] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:25:00.572] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 5/3. -[2026-03-19T15:25:00.573] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:25:00.573] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:25:00.574] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:29:10.082] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 6/3. -[2026-03-19T15:29:10.084] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:29:10.084] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:29:10.084] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:33:19.474] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 7/3. -[2026-03-19T15:33:19.475] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:33:19.475] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:33:19.475] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:37:28.886] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 8/3. -[2026-03-19T15:37:28.886] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:37:28.887] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:37:28.887] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:41:38.214] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 9/3. -[2026-03-19T15:41:38.215] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:41:38.215] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:41:38.215] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:45:47.554] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 10/3. -[2026-03-19T15:45:47.555] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:45:47.556] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:45:47.556] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:49:57.051] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 11/3. -[2026-03-19T15:49:57.051] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:49:57.052] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:49:57.052] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:54:06.519] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 12/3. -[2026-03-19T15:54:06.520] Executing reboot command: /usr/bin/sudo systemctl reboot -[2026-03-19T15:54:06.553] Failed to execute reboot command: Base.IOError("could not spawn `/usr/bin/sudo systemctl reboot`: no such file or directory (ENOENT)", -2) -[2026-03-19T15:54:06.554] Reboot attempt failed; will retry after next interval. -[2026-03-19T15:58:26.336] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T15:58:26.462] 192.168.88.1 is reachable; resetting consecutive failure counter. -[2026-03-19T16:27:27.839] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T16:34:04.850] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 1/3. -[2026-03-19T16:38:14.247] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 2/3. -[2026-03-19T16:42:23.657] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 3/3. -[2026-03-19T16:42:23.669] Executing reboot command: /bin/systemctl reboot -[2026-03-19T16:42:23.678] Reboot executed (or simulated). Resetting failure counter. -[2026-03-19T16:43:49.992] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T16:43:50.104] In cooldown after recent reboot; skipping check. 86/600 seconds -[2026-03-19T16:44:50.144] In cooldown after recent reboot; skipping check. 146/600 seconds -[2026-03-19T16:45:50.206] In cooldown after recent reboot; skipping check. 206/600 seconds -[2026-03-19T16:46:50.222] In cooldown after recent reboot; skipping check. 266/600 seconds -[2026-03-19T16:47:50.283] In cooldown after recent reboot; skipping check. 326/600 seconds -[2026-03-19T16:48:50.344] In cooldown after recent reboot; skipping check. 386/600 seconds -[2026-03-19T16:49:50.351] In cooldown after recent reboot; skipping check. 446/600 seconds -[2026-03-19T16:50:50.412] In cooldown after recent reboot; skipping check. 506/600 seconds -[2026-03-19T16:51:50.465] In cooldown after recent reboot; skipping check. 566/600 seconds -[2026-03-19T16:56:00.122] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 1/3. -[2026-03-19T17:00:09.642] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 2/3. -[2026-03-19T17:04:19.199] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 3/3. -[2026-03-19T17:04:19.213] Executing reboot command: /bin/systemctl reboot -[2026-03-19T17:04:19.221] Reboot executed (or simulated). Resetting failure counter. -[2026-03-19T17:05:36.172] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T17:05:36.285] In cooldown after recent reboot; skipping check. 77/600 seconds -[2026-03-19T17:06:36.327] In cooldown after recent reboot; skipping check. 137/600 seconds -[2026-03-19T17:07:36.348] In cooldown after recent reboot; skipping check. 197/600 seconds -[2026-03-19T17:08:36.359] In cooldown after recent reboot; skipping check. 257/600 seconds -[2026-03-19T17:09:36.420] In cooldown after recent reboot; skipping check. 317/600 seconds -[2026-03-19T18:15:58.573] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T18:19:34.550] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 1/3. -[2026-03-19T18:23:44.126] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 2/3. -[2026-03-19T18:27:53.662] 192.168.88.1 is unreachable (last result: ProcessFailedException(Base.Process[Process(`ping -c 1 -W 30 192.168.88.1`, ProcessExited(1))])). Consecutive fails: 3/3. -[2026-03-19T18:27:53.673] Executing reboot command: /bin/systemctl reboot -[2026-03-19T18:27:53.682] Reboot executed (or simulated). Resetting failure counter. -[2026-03-19T18:30:25.480] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T18:30:25.618] In cooldown after recent reboot; skipping check. 151/600 seconds -[2026-03-19T18:31:25.627] In cooldown after recent reboot; skipping check. 211/600 seconds -[2026-03-19T18:32:25.631] In cooldown after recent reboot; skipping check. 271/600 seconds -[2026-03-19T18:33:25.644] In cooldown after recent reboot; skipping check. 331/600 seconds -[2026-03-19T18:34:25.706] In cooldown after recent reboot; skipping check. 392/600 seconds -[2026-03-19T18:35:25.731] In cooldown after recent reboot; skipping check. 452/600 seconds -[2026-03-19T18:36:25.793] In cooldown after recent reboot; skipping check. 512/600 seconds -[2026-03-19T18:37:25.855] In cooldown after recent reboot; skipping check. 572/600 seconds -[2026-03-19T20:46:13.597] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-19T21:11:24.478] Error during check: UndefVarError(:last_result, 0x000000000000975f, Main) -[2026-03-19T21:15:32.383] Error during check: UndefVarError(:last_result, 0x000000000000975f, Main) -[2026-03-19T21:19:41.791] Error during check: UndefVarError(:last_result, 0x000000000000975f, Main) -[2026-03-20T06:30:24.932] Starting check loop. Checking router 192.168.88.1 every 60 seconds. -[2026-03-20T06:33:34.781] Error during check: UndefVarError(:last_result, 0x000000000000975f, Main) -[2026-03-20T06:34:34.835] 192.168.88.1 is reachable; resetting consecutive failure counter. -[2026-03-20T06:50:10.447] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T07:22:26.223] DRY RUN: would run reboot command: /bin/systemctl reboot +[2026-03-20T07:22:26.224] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T07:34:46.993] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T07:34:48.140] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3. +[2026-03-20T07:35:48.328] 192.168.88.1 is reachable; resetting consecutive failure counter. +[2026-03-20T07:36:49.337] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3. +[2026-03-20T07:37:50.385] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3. +[2026-03-20T07:38:51.439] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3. +[2026-03-20T07:38:51.451] DRY RUN: would run reboot command: /bin/systemctl reboot +[2026-03-20T07:38:51.452] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:01:26.083] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:03:30.730] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3. +[2026-03-20T08:04:34.872] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3. +[2026-03-20T08:05:39] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3. +[2026-03-20T08:05:39.012] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:05:39.019] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:07:37.784] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:07:42.190] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:08:42.390] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:10:13.455] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:11:17.576] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:12:21.703] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:12:21.703] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:12:21.715] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:12:21.722] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:14:14.104] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:14:14.238] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:15:14.374] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:16:14.436] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:17:14.458] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:18:14.474] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:19:45.773] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:20:49.912] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:21:53.976] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:21:53.976] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:21:53.988] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:21:53.995] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:24:02.098] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:24:06.510] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:25:10.722] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:26:14.850] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:26:14.851] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:26:14.862] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:26:14.869] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:27:50.027] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:27:54.438] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:28:58.658] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:30:02.786] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:30:02.787] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:30:02.797] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:30:02.804] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:31:38.059] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:31:42.504] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:32:46.784] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:33:50.912] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:33:50.912] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:33:50.923] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:33:50.930] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:35:25.114] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:35:29.577] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:36:33.792] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:37:37.920] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:37:37.952] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:37:37.962] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:37:37.969] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:39:12.910] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:39:17.371] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:40:21.592] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:41:25.719] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:41:25.720] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:41:25.731] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:41:25.738] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:43:02.074] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:43:06.506] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:44:10.719] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:45:14.847] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:45:14.848] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:45:14.859] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:45:14.866] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:46:49.831] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:46:54.237] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:47:58.458] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:49:02.586] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:49:02.586] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:49:02.597] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:49:02.604] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:50:37.054] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:50:41.498] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:51:45.720] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:52:49.848] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:52:49.849] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:52:49.859] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:52:49.867] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:54:24.890] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:54:29.366] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3. +[2026-03-20T08:55:33.590] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3. +[2026-03-20T08:56:37.653] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3. +[2026-03-20T08:56:37.654] Cooldown has expired and router is still unreachable. Triggering reboot. +[2026-03-20T08:56:37.666] Executing reboot command: /bin/systemctl reboot +[2026-03-20T08:56:37.673] Reboot executed (or simulated). Resetting failure counter. +[2026-03-20T08:58:14.067] Starting check loop. Checking router 192.168.88.1 every 60 seconds. +[2026-03-20T08:58:14.202] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T08:59:14.320] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:00:14.415] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:01:14.477] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:02:14.534] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:03:14.597] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:04:14.660] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:05:14.722] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. +[2026-03-20T09:06:14.784] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state. diff --git a/test_ping_result.json b/test_ping_result.json new file mode 100644 index 0000000..1856ea0 --- /dev/null +++ b/test_ping_result.json @@ -0,0 +1 @@ +{"ok": false, "result": "no response"} \ No newline at end of file