update
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"last_reboot_datetime":"2026-03-20T14:46:18.848","consecutive_fails":0}
|
{"last_reboot_datetime":"2026-03-20T15:23:19.868","consecutive_fails":2}
|
||||||
@@ -25,8 +25,8 @@ const TIMEOUT_SECS = 30 # request timeout
|
|||||||
const ATTEMPTS_PER_CHECK = 1 # number of ping attempts per check
|
const ATTEMPTS_PER_CHECK = 1 # number of ping attempts per check
|
||||||
const BACKOFF_BETWEEN_ATTEMPTS = 1 # seconds between ping attempts
|
const BACKOFF_BETWEEN_ATTEMPTS = 1 # seconds between ping attempts
|
||||||
const FAILS_TO_REBOOT = 3 # consecutive failed checks required to trigger reboot
|
const FAILS_TO_REBOOT = 3 # consecutive failed checks required to trigger reboot
|
||||||
const COOLDOWN_AFTER_REBOOT_SECS = 120 # do not reboot again within this many seconds
|
const COOLDOWN_AFTER_REBOOT_SECS = 300 # 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 CHECK_INTERVAL_SECS = 60 # run a check every CHECK_INTERVAL_SECS seconds
|
||||||
|
|
||||||
const thisFolderPath = @__DIR__
|
const thisFolderPath = @__DIR__
|
||||||
@@ -237,8 +237,12 @@ function perform_check!(st::State)
|
|||||||
success = false
|
success = false
|
||||||
last_result = nothing
|
last_result = nothing
|
||||||
for i in 1:ATTEMPTS_PER_CHECK
|
for i in 1:ATTEMPTS_PER_CHECK
|
||||||
# ok, result = check_router_once(ROUTER_IP)
|
|
||||||
ok, result = values(JSON.parsefile("/home/ton/docker-programs/check_and_reboot/test_ping_result.json")) # for testing without actual ping
|
# # for testing without actual ping
|
||||||
|
# ok, result = values(JSON.parsefile("/home/ton/docker-programs/check_and_reboot/test_ping_result.json"))
|
||||||
|
|
||||||
|
ok, result = check_router_once(ROUTER_IP)
|
||||||
|
|
||||||
if ok
|
if ok
|
||||||
success = true
|
success = true
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
[2026-03-20T10:46:02.700] Executing reboot command: /bin/systemctl reboot
|
|
||||||
[2026-03-20T10:46:02.900] Reboot executed (or simulated). Resetting failure counter.
|
|
||||||
[2026-03-20T10:47:22.509] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
|
|
||||||
[2026-03-20T10:47:25.404] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
|
|
||||||
[2026-03-20T10:48:27.041] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3.
|
|
||||||
[2026-03-20T10:49:28.096] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3.
|
|
||||||
[2026-03-20T10:49:28.100] Cooldown has expired and router is still unreachable. Triggering reboot.
|
|
||||||
[2026-03-20T10:49:28.350] Executing reboot command: /bin/systemctl reboot
|
|
||||||
[2026-03-20T10:49:28.409] Reboot executed (or simulated). Resetting failure counter.
|
[2026-03-20T10:49:28.409] Reboot executed (or simulated). Resetting failure counter.
|
||||||
[2026-03-20T10:50:49.333] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
|
[2026-03-20T10:50:49.333] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
|
||||||
[2026-03-20T10:50:50.033] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
|
[2026-03-20T10:50:50.033] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
|
||||||
@@ -106,3 +98,11 @@
|
|||||||
[2026-03-20T14:46:18.745] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
|
[2026-03-20T14:46:18.745] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
|
||||||
[2026-03-20T14:46:18.841] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
|
[2026-03-20T14:46:18.841] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
|
||||||
[2026-03-20T14:46:18.844] Reboot executed (or simulated). Resetting failure counter.
|
[2026-03-20T14:46:18.844] Reboot executed (or simulated). Resetting failure counter.
|
||||||
|
[2026-03-20T15:21:15.466] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
|
||||||
|
[2026-03-20T15:21:17.191] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
|
||||||
|
[2026-03-20T15:22:18.736] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
|
||||||
|
[2026-03-20T15:23:19.802] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
|
||||||
|
[2026-03-20T15:23:19.865] DRY RUN: would run reboot command: /bin/systemctl reboot
|
||||||
|
[2026-03-20T15:23:19.867] Reboot executed (or simulated). Resetting failure counter.
|
||||||
|
[2026-03-20T15:24:21.083] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
|
||||||
|
[2026-03-20T15:25:22.150] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
|
||||||
|
|||||||
Reference in New Issue
Block a user