Compare commits

..

16 Commits

Author SHA1 Message Date
9a0cb6d272 update 2026-04-18 20:11:49 +07:00
77c06befda add limitTextFileLines before log 2026-04-18 19:17:07 +07:00
638e05a13a update 2026-03-20 15:25:52 +07:00
eaa55c69b4 update 2026-03-20 15:18:07 +07:00
03eb96661e update 2026-03-20 15:10:10 +07:00
baa3b60ef3 update 2026-03-20 15:09:40 +07:00
2d1f10cd26 update 2026-03-20 15:07:06 +07:00
231051bd8f update 2026-03-20 14:54:52 +07:00
67eea6f149 update 2026-03-20 14:49:18 +07:00
ff7f95e1bb update 2026-03-20 14:48:06 +07:00
0682019085 remove reboot during cooldown 2026-03-20 11:00:12 +07:00
e2b7d93035 update 2026-03-20 10:22:49 +07:00
43929736ca update 2026-03-20 10:15:01 +07:00
f0e0bf4db8 update 2026-03-20 09:19:23 +07:00
bd12ee9e49 update 2026-03-20 09:06:21 +07:00
6f77993798 update 2026-03-20 06:51:44 +07:00
7 changed files with 378 additions and 207 deletions

View File

@@ -2,18 +2,66 @@
julia_version = "1.12.5" julia_version = "1.12.5"
manifest_format = "2.0" manifest_format = "2.0"
project_hash = "9b274fc74610c14aa65af9a9d85650d80d379917" project_hash = "b869f60c186657e1a66a3bb09e6f25647cba4a4b"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.BitFlags]]
git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.9"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "962834c22b66e32aa10f7611c08c8ca4e20749a9"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.8"
[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "21d088c496ea22914fe80906eb5bce65755e5ec8"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.5.1"
[[deps.Dates]] [[deps.Dates]]
deps = ["Printf"] deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
version = "1.11.0" version = "1.11.0"
[[deps.ExceptionUnwrapping]]
deps = ["Test"]
git-tree-sha1 = "d36f682e590a83d63d1c7dbd287573764682d12a"
uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
version = "0.1.11"
[[deps.HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "PrecompileTools", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "51059d23c8bb67911a2e6fd5130229113735fc7e"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "1.11.0"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
version = "1.11.0"
[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "0533e564aae234aff59ab625543145446d8b6ec2"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.7.1"
[[deps.JSON]] [[deps.JSON]]
deps = ["Dates", "Logging", "Parsers", "PrecompileTools", "StructUtils", "UUIDs", "Unicode"] deps = ["Dates", "Logging", "Parsers", "PrecompileTools", "StructUtils", "UUIDs", "Unicode"]
git-tree-sha1 = "eb04df293213df64ddd720c86de3c431f5f8ccf1" git-tree-sha1 = "b3ad4a0255688dcb895a52fafbaae3023b588a90"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "1.2.1" version = "1.4.0"
[deps.JSON.extensions] [deps.JSON.extensions]
JSONArrowExt = ["ArrowTypes"] JSONArrowExt = ["ArrowTypes"]
@@ -21,10 +69,61 @@ version = "1.2.1"
[deps.JSON.weakdeps] [deps.JSON.weakdeps]
ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd"
[[deps.JuliaSyntaxHighlighting]]
deps = ["StyledStrings"]
uuid = "ac6e5ff7-fb65-4e79-a425-ec3bc9c03011"
version = "1.12.0"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
version = "1.11.0"
[[deps.Logging]] [[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
version = "1.11.0" version = "1.11.0"
[[deps.LoggingExtras]]
deps = ["Dates", "Logging"]
git-tree-sha1 = "f00544d95982ea270145636c181ceda21c4e2575"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "1.2.0"
[[deps.Markdown]]
deps = ["Base64", "JuliaSyntaxHighlighting", "StyledStrings"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
version = "1.11.0"
[[deps.MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"]
git-tree-sha1 = "8785729fa736197687541f7053f6d8ab7fc44f92"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.1.10"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "ff69a2b1330bcb730b9ac1ab7dd680176f5896b8"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.1010+0"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2025.11.4"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.3.0"
[[deps.OpenSSL]]
deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "NetworkOptions", "OpenSSL_jll", "Sockets"]
git-tree-sha1 = "1d1aaa7d449b58415f97d2839c318b70ffb525a0"
uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c"
version = "1.6.1"
[[deps.OpenSSL_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.5.4+0"
[[deps.Parsers]] [[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"] deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "7d2f8f21da5db6a806faf7b9b292296da42b2810" git-tree-sha1 = "7d2f8f21da5db6a806faf7b9b292296da42b2810"
@@ -39,9 +138,9 @@ version = "1.3.3"
[[deps.Preferences]] [[deps.Preferences]]
deps = ["TOML"] deps = ["TOML"]
git-tree-sha1 = "0f27480397253da18fe2c12a4ba4eb9eb208bf3d" git-tree-sha1 = "8b770b60760d4451834fe79dd483e318eee709c4"
uuid = "21216c6a-2e73-6563-6e65-726566657250" uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.5.0" version = "1.5.2"
[[deps.Printf]] [[deps.Printf]]
deps = ["Unicode"] deps = ["Unicode"]
@@ -57,25 +156,59 @@ version = "1.11.0"
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0" version = "0.7.0"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
version = "1.11.0"
[[deps.SimpleBufferStream]]
git-tree-sha1 = "f305871d2f381d21527c770d4788c06c097c9bc1"
uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7"
version = "1.2.0"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
version = "1.11.0"
[[deps.StructUtils]] [[deps.StructUtils]]
deps = ["Dates", "UUIDs"] deps = ["Dates", "UUIDs"]
git-tree-sha1 = "79529b493a44927dd5b13dde1c7ce957c2d049e4" git-tree-sha1 = "fa95b3b097bcef5845c142ea2e085f1b2591e92c"
uuid = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42" uuid = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42"
version = "2.6.0" version = "2.7.1"
[deps.StructUtils.extensions] [deps.StructUtils.extensions]
StructUtilsMeasurementsExt = ["Measurements"] StructUtilsMeasurementsExt = ["Measurements"]
StructUtilsStaticArraysCoreExt = ["StaticArraysCore"]
StructUtilsTablesExt = ["Tables"] StructUtilsTablesExt = ["Tables"]
[deps.StructUtils.weakdeps] [deps.StructUtils.weakdeps]
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
[[deps.StyledStrings]]
uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
version = "1.11.0"
[[deps.TOML]] [[deps.TOML]]
deps = ["Dates"] deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3" version = "1.0.3"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
version = "1.11.0"
[[deps.TranscodingStreams]]
git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.11.3"
[[deps.URIs]]
git-tree-sha1 = "bef26fb046d031353ef97a82e3fdb6afe7f21b1a"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.6.1"
[[deps.UUIDs]] [[deps.UUIDs]]
deps = ["Random", "SHA"] deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
@@ -84,3 +217,8 @@ version = "1.11.0"
[[deps.Unicode]] [[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
version = "1.11.0" version = "1.11.0"
[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.3.1+2"

View File

@@ -1,3 +1,4 @@
[deps] [deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"

View File

@@ -29,11 +29,11 @@ Both scripts run continuously in the background, performing periodic health chec
```julia ```julia
const ROUTER_IP = "192.168.88.1" # Target router IP address const ROUTER_IP = "192.168.88.1" # Target router IP address
const TIMEOUT_SECS = 30 # Request timeout in seconds const TIMEOUT_SECS = 30 # Request timeout in seconds
const ATTEMPTS_PER_CHECK = 3 # Number of ping attempts per check const ATTEMPTS_PER_CHECK = 1 # Number of ping attempts per check
const BACKOFF_BETWEEN_ATTEMPTS = 60 # Seconds between retry attempts const BACKOFF_BETWEEN_ATTEMPTS = 1 # Seconds between retry attempts
const FAILS_TO_REBOOT = 3 # Consecutive failures before reboot const FAILS_TO_REBOOT = 3 # Consecutive failures before reboot
const COOLDOWN_AFTER_REBOOT_SECS = 600 # Minimum seconds between reboots const COOLDOWN_AFTER_REBOOT_SECS = 600 # Minimum seconds between reboots
const DRY_RUN = true # Set false to enable actual reboots const DRY_RUN = false # Set false to enable actual reboots
const CHECK_INTERVAL_SECS = 60 # Check interval in seconds const CHECK_INTERVAL_SECS = 60 # Check interval in seconds
``` ```

View File

@@ -1 +1 @@
{"last_reboot_datetime":"2026-03-19T18:27:53.682","consecutive_fails":0} {"last_reboot_datetime":"2026-03-20T15:23:19.868","consecutive_fails":2}

View File

@@ -7,26 +7,33 @@
# ------------------------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------------------------ #
# add the following to root's crontab (sudo crontab -e) # # add the following to root's crontab (sudo crontab -e) #
# ------------------------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------------------------ #
# *** juliar is root's julia (sudo crontab -e) but I symlinked to juliar because I want to seperate it from user's julia
# @reboot /usr/local/bin/juliar /home/ton/docker-programs/check_and_reboot/check_router_reboot.jl >> /var/log/check_reboot.log 2>&1 # ---------------- For PC that has juliar for root user and julia for normal user ---------------- #
# @reboot /root/.juliaup/bin/julia /root/docker-apps/check_and_reboot/check_router_reboot.jl >> /var/log/check_reboot.log 2>&1 # linux_prompt> @reboot sleep 30 && /usr/local/bin/juliar /home/ton/docker-programs/check_and_reboot/check_router_reboot.jl >> /var/log/check_reboot.log 2>&1
# *** juliar is julia that I install separately for root user (sudo crontab -e) which I symlinked to juliar because I want to separate it from user's julia
# ---------------------------------- For PC that has only julia ---------------------------------- #
# linux_prompt> @reboot sleep 30 && /root/.juliaup/bin/julia /root/docker-apps/check_and_reboot/check_router_reboot.jl >> /var/log/check_reboot.log 2>&1
using Dates, Printf, JSON using Dates, Printf, JSON
# Configuration # Configuration
const ROUTER_IP = "192.168.88.1" const ROUTER_IP = "192.168.88.1"
const TIMEOUT_SECS = 30 # request timeout const TIMEOUT_SECS = 30 # request timeout
const ATTEMPTS_PER_CHECK = 3 # number of ping attempts per check const ATTEMPTS_PER_CHECK = 1 # number of ping attempts per check
const BACKOFF_BETWEEN_ATTEMPTS = 60 # seconds between 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 = 600 # 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 = false # 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__
const thisFilePath = @__FILE__
const LogFilePath = "$thisFolderPath/check_router_reboot_log.txt" # write logs here and also broadcast const LogFilePath = "$thisFolderPath/check_router_reboot_log.txt" # write logs here and also broadcast
const StateFilePath = "$thisFolderPath/check_and_reboot_state.json" const StateFilePath = "$thisFolderPath/check_and_reboot_state.json"
# println(0)
# Simple broadcast helper # Simple broadcast helper
# Simple broadcast helper (safe Cmd construction) # Simple broadcast helper (safe Cmd construction)
function broadcast_msg(msg::AbstractString) function broadcast_msg(msg::AbstractString)
@@ -120,6 +127,7 @@ function load_state(StateFilePath)
return State(cf, DateTime(lr)) return State(cf, DateTime(lr))
end end
catch e catch e
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Warning loading state: $e") logmsg("Warning loading state: $e")
end end
return State(0, nothing) return State(0, nothing)
@@ -199,6 +207,7 @@ end
function do_reboot() function do_reboot()
cmd = reboot_command() cmd = reboot_command()
if cmd === nothing if cmd === nothing
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Reboot not supported on this OS") logmsg("Reboot not supported on this OS")
return false return false
end end
@@ -207,10 +216,11 @@ function do_reboot()
cmd_str = join(map(x -> replace(x, '"' => "\\\""), cmd), " ") cmd_str = join(map(x -> replace(x, '"' => "\\\""), cmd), " ")
if DRY_RUN if DRY_RUN
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("DRY RUN: would run reboot command: $cmd_str") logmsg("DRY RUN: would run reboot command: $cmd_str")
return true return true
end end
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Executing reboot command: $cmd_str") logmsg("Executing reboot command: $cmd_str")
try try
# Construct a Cmd from an array so arguments are passed directly (no shell) # Construct a Cmd from an array so arguments are passed directly (no shell)
@@ -218,6 +228,7 @@ function do_reboot()
run(Cmd(cmd_array)) run(Cmd(cmd_array))
return true return true
catch e catch e
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Failed to execute reboot command: $e") logmsg("Failed to execute reboot command: $e")
return false return false
end end
@@ -226,104 +237,124 @@ end
# Single check iteration # Single check iteration
function perform_check!(st::State) function perform_check!(st::State)
# Check if we're in cooldown period # println(1)
in_cooldown = false success = false
if st.last_reboot_datetime !== nothing last_result = nothing
timepass = ((Dates.now() - st.last_reboot_datetime).value / 1000) |> floor |> Int for i in 1:ATTEMPTS_PER_CHECK
if timepass < COOLDOWN_AFTER_REBOOT_SECS # # for testing without actual ping
in_cooldown = true # 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
success = true
break
end end
end sleep(BACKOFF_BETWEEN_ATTEMPTS)
end
routerresult = isnothing(last_result) ? "no response" : last_result
success = false # Check if we're in cooldown period
last_res7ult = nothing in_cooldown = false
for i in 1:ATTEMPTS_PER_CHECK if st.last_reboot_datetime !== nothing
ok, result = check_router_once(ROUTER_IP) timepass = ((Dates.now() - st.last_reboot_datetime).value / 1000) |> floor |> Int
last_result = result if timepass < COOLDOWN_AFTER_REBOOT_SECS
if ok in_cooldown = true
success = true
break
end
sleep(BACKOFF_BETWEEN_ATTEMPTS)
end end
end
if in_cooldown # @show in_cooldown
# During cooldown, track failures but don't trigger reboot yet # println(2)
if success if in_cooldown
logmsg("$ROUTER_IP is reachable during cooldown. Router is back online! Resetting state.") # println("2-1")
st.consecutive_fails = 0 # During cooldown, track failures but don't trigger reboot yet
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
end
# Outside cooldown - full check with potential reboot
if success if success
if st.consecutive_fails > 0 broadcast_msg("Broadcasting from file: $thisFilePath")
logmsg("$ROUTER_IP is reachable; resetting consecutive failure counter.") limitTextFileLines(LogFilePath; maxlines=100)
else logmsg("$ROUTER_IP is reachable during cooldown. Router is back online! Resetting state.")
# logmsg("$ROUTER_IP is reachable.") st.consecutive_fails = 0
end save_state(st, StateFilePath)
st.consecutive_fails = 0
save_state(st, StateFilePath)
return
else else
st.consecutive_fails += 1 # println("2-2")
routerresult = isnothing(last_result) ? "no response" : last_result st.consecutive_fails += 1
logmsg("$ROUTER_IP is unreachable (last result: $routerresult). Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.") broadcast_msg("Broadcasting from file: $thisFilePath")
save_state(st, StateFilePath) limitTextFileLines(LogFilePath; maxlines=100)
logmsg("$ROUTER_IP is unreachable during cooldown. Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.")
save_state(st, StateFilePath)
end end
if st.consecutive_fails >= FAILS_TO_REBOOT return
save_state(st, StateFilePath) end
ok = do_reboot() # println(3)
if ok # Outside cooldown - full check with potential reboot
thisFilePath = @__FILE__ if success
broadcast_msg("Broadcasting from file: $thisFilePath") # println("3-1")
logmsg("Reboot executed (or simulated). Resetting failure counter.") if st.consecutive_fails > 0
st.consecutive_fails = 0 # println("3-2")
st.last_reboot_datetime = Dates.now() limitTextFileLines(LogFilePath; maxlines=100)
save_state(st, StateFilePath) logmsg("$ROUTER_IP is reachable; resetting consecutive failure counter.")
else else
logmsg("Reboot attempt failed; will retry after next interval.") # logmsg("$ROUTER_IP is reachable.")
end
end end
st.consecutive_fails = 0
save_state(st, StateFilePath)
return
else
st.consecutive_fails += 1
broadcast_msg("Broadcasting from file: $thisFilePath")
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("$ROUTER_IP is unreachable (last result: $routerresult). Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.")
save_state(st, StateFilePath)
end
# println(4)
if st.consecutive_fails >= FAILS_TO_REBOOT
# println("4-1")
save_state(st, StateFilePath)
ok = do_reboot()
if ok
# println("4-2")
broadcast_msg("Broadcasting from file: $thisFilePath")
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Reboot executed (or simulated). Resetting failure counter.")
st.consecutive_fails = 0
st.last_reboot_datetime = Dates.now()
@show st
@show StateFilePath
save_state(st, StateFilePath)
else
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Reboot attempt failed; will retry after next interval.")
end
end
# println(5)
end end
function limitTextFileLines(LogFilePath::String; maxlines::Integer=100) function limitTextFileLines(LogFilePath::String; maxlines::Integer=100)
log = readlines(LogFilePath) log = readlines(LogFilePath)
if length(log) < (maxlines - 1) total_lines = length(log)
if total_lines < maxlines
return nothing return nothing
end end
exceeding_row = total_lines - maxlines # can be 0 or more
reduced_lines = log[exceeding_row+2:end]
reducedLog = "" reducedLog = ""
for i in log[end-(maxlines-1):end] for i in reduced_lines
reducedLog = reducedLog * i * "\n" reducedLog = reducedLog * i * "\n"
end end
write(LogFilePath, reducedLog) write(LogFilePath, reducedLog)
end end
# function limitTextFileLines(LogFilePath::String; maxlines::Integer=100)
# log = readlines(LogFilePath)
# if length(log) < (maxlines - 1)
# return nothing
# end
# reducedLog = ""
# for i in log[end-(maxlines-1):end]
# reducedLog = reducedLog * i * "\n"
# end
# write(LogFilePath, reducedLog)
# end
# Main loop: runs indefinitely every CHECK_INTERVAL_SECS # Main loop: runs indefinitely every CHECK_INTERVAL_SECS
function main_loop() function main_loop()
# Ensure log file exists # Ensure log file exists
@@ -333,15 +364,16 @@ function main_loop()
end end
end end
# limit log file to latest 100 events # limit log file to latest 100 events
limitTextFileLines(LogFilePath; maxlines=100)
thisFilePath = @__FILE__ thisFilePath = @__FILE__
broadcast_msg("Broadcasting from file: $thisFilePath") broadcast_msg("Broadcasting from file: $thisFilePath")
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Starting check loop. Checking router $ROUTER_IP every $(CHECK_INTERVAL_SECS) seconds.") logmsg("Starting check loop. Checking router $ROUTER_IP every $(CHECK_INTERVAL_SECS) seconds.")
st = load_state(StateFilePath) st = load_state(StateFilePath)
while true while true
try try
perform_check!(st) perform_check!(st)
catch e catch e
limitTextFileLines(LogFilePath; maxlines=100)
logmsg("Error during check: $e") logmsg("Error during check: $e")
end end
sleep(CHECK_INTERVAL_SECS) sleep(CHECK_INTERVAL_SECS)

View File

@@ -1,109 +1,108 @@
[2026-03-11T15:51:04.131] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:49:28.409] Reboot executed (or simulated). Resetting failure counter.
[2026-03-11T15:52:04.197] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:50:49.333] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-11T15:53:04.266] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:50:50.033] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:10:04.474] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T10:51:50.626] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:10:05.449] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:52:50.699] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:12:13.704] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T10:53:50.763] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:12:14.671] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:54:50.784] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:13:14.215] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T10:55:50.800] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:13:15.192] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:56:51.025] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:14:19.623] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T10:57:51.056] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:14:20.610] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T10:58:51.132] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[2026-03-11T16:14:54.601] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T11:04:22.285] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-11T16:14:55.573] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T11:10:08.650] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-11T16:15:48.563] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T11:10:10.725] Error during check: UndefVarError(:thisFilePath, 0x000000000000975f, :local)
[2026-03-11T16:15:49.540] Error during check: SystemError("opening file \"/home/ton/docker-programs/check_and_reboot/check_and_reboot_state.json\"", 13, nothing) [2026-03-20T11:12:40.556] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-11T16:27:47.181] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T11:12:43.912] Error during check: SystemError("opening file \"test_ping_result.json\"", 2, nothing)
[2026-03-11T16:30:28.572] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T12:42:13.923] 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-20T12:42:15.861] Error during check: UndefVarError(:thisFilePath, 0x000000000000975f, :local)
[2026-03-11T17:37:15.954] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T12:43:25.591] 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-20T12:43:27.556] Error during check: UndefVarError(:thisFilePath, 0x000000000000975f, :local)
[2026-03-11T20:50:40.732] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T12:44:06.281] 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-20T12:44:08.202] Error during check: UndefVarError(:thisFilePath, 0x000000000000975f, :local)
[2026-03-18T15:31:58.643] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T12:45:23.028] 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-20T12:45:24.799] 192.168.88.1 is unreachable (last result: no response). 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-20T12:46:26.403] 192.168.88.1 is unreachable (last result: no response). 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-20T12:47:27.427] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T15:16:44.266] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T12:47:27.525] DRY RUN: would run 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-20T12:47:27.528] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T15:16:44.305] Reboot attempt failed; will retry after next interval. [2026-03-20T12:48:06.389] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T12:48:08.162] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:20:53.853] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T12:49:09.763] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[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-20T12:50:10.833] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T15:20:53.853] Reboot attempt failed; will retry after next interval. [2026-03-20T12:50:10.937] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[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-20T12:50:10.942] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T15:25:00.573] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T12:54:25.047] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T12:54:26.823] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:25:00.574] Reboot attempt failed; will retry after next interval. [2026-03-20T12:56:13.713] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T12:56:15.487] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:29:10.084] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T12:57:17.055] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[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-20T12:58:18.125] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T15:29:10.084] Reboot attempt failed; will retry after next interval. [2026-03-20T12:58:18.353] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[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-20T12:58:18.357] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T15:33:19.475] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T12:59:43.699] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T12:59:45.472] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:33:19.475] Reboot attempt failed; will retry after next interval. [2026-03-20T13:00:47.029] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[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-20T13:01:48.056] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T15:37:28.886] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T13:01:48.151] DRY RUN: would run 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-20T13:01:48.154] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T15:37:28.887] Reboot attempt failed; will retry after next interval. [2026-03-20T13:02:22.831] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:02:24.606] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T15:41:38.215] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T13:03:06.170] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:03:08.073] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:41:38.215] Reboot attempt failed; will retry after next interval. [2026-03-20T13:06:43.902] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:06:45.688] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:45:47.555] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T13:20:26.911] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:20:27.794] Error during check: SystemError("opening file \"test_ping_result.json\"", 2, nothing)
[2026-03-19T15:45:47.556] Reboot attempt failed; will retry after next interval. [2026-03-20T13:22:32.247] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:22:34.026] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T15:49:57.051] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T13:23:38.078] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:23:39.856] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[2026-03-19T15:49:57.052] Reboot attempt failed; will retry after next interval. [2026-03-20T13:24:16.835] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:24:18.606] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T15:54:06.520] Executing reboot command: /usr/bin/sudo systemctl reboot [2026-03-20T13:24:19.209] DRY RUN: would run 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-20T13:24:19.213] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T15:54:06.554] Reboot attempt failed; will retry after next interval. [2026-03-20T13:25:20.400] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T15:58:26.336] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T13:26:21.625] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3.
[2026-03-19T15:58:26.462] 192.168.88.1 is reachable; resetting consecutive failure counter. [2026-03-20T13:27:22.681] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 3/3.
[2026-03-19T16:27:27.839] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T13:28:23.700] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 4/3.
[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-20T13:29:04.947] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[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-20T13:29:06.721] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 5/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-20T14:32:48.752] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-19T16:42:23.669] Executing reboot command: /bin/systemctl reboot [2026-03-20T14:32:50.528] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 6/3.
[2026-03-19T16:42:23.678] Reboot executed (or simulated). Resetting failure counter. [2026-03-20T14:32:51.123] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[2026-03-19T16:43:49.992] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T14:32:51.128] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T16:43:50.104] In cooldown after recent reboot; skipping check. 86/600 seconds [2026-03-20T14:33:52.347] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T16:44:50.144] In cooldown after recent reboot; skipping check. 146/600 seconds [2026-03-20T14:34:53.367] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[2026-03-19T16:45:50.206] In cooldown after recent reboot; skipping check. 206/600 seconds [2026-03-20T14:35:54.418] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T16:46:50.222] In cooldown after recent reboot; skipping check. 266/600 seconds [2026-03-20T14:35:54.452] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[2026-03-19T16:47:50.283] In cooldown after recent reboot; skipping check. 326/600 seconds [2026-03-20T14:35:54.455] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T16:48:50.344] In cooldown after recent reboot; skipping check. 386/600 seconds [2026-03-20T14:36:55.528] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T16:49:50.351] In cooldown after recent reboot; skipping check. 446/600 seconds [2026-03-20T14:38:00.916] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-19T16:50:50.412] In cooldown after recent reboot; skipping check. 506/600 seconds [2026-03-20T14:38:02.688] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[2026-03-19T16:51:50.465] In cooldown after recent reboot; skipping check. 566/600 seconds [2026-03-20T14:39:04.303] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[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-20T14:39:04.396] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[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-20T14:39:04.398] Reboot executed (or simulated). Resetting failure counter.
[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-20T14:39:32.271] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-19T17:04:19.213] Executing reboot command: /bin/systemctl reboot [2026-03-20T14:39:34.046] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T17:04:19.221] Reboot executed (or simulated). Resetting failure counter. [2026-03-20T14:40:27.209] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-19T17:05:36.172] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T14:40:28.984] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 2/3.
[2026-03-19T17:05:36.285] In cooldown after recent reboot; skipping check. 77/600 seconds [2026-03-20T14:41:30.736] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T17:06:36.327] In cooldown after recent reboot; skipping check. 137/600 seconds [2026-03-20T14:41:30.836] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[2026-03-19T17:07:36.348] In cooldown after recent reboot; skipping check. 197/600 seconds [2026-03-20T14:41:30.839] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T17:08:36.359] In cooldown after recent reboot; skipping check. 257/600 seconds [2026-03-20T14:42:13.075] Starting check loop. Checking router 192.168.88.1 every 60 seconds.
[2026-03-19T17:09:36.420] In cooldown after recent reboot; skipping check. 317/600 seconds [2026-03-20T14:42:14.852] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T18:15:58.573] Starting check loop. Checking router 192.168.88.1 every 60 seconds. [2026-03-20T14:43:15.578] 192.168.88.1 is reachable during cooldown. Router is back online! Resetting state.
[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-20T14:44:16.617] 192.168.88.1 is unreachable (last result: no response). 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-20T14:45:17.675] 192.168.88.1 is unreachable (last result: no response). 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-20T14:46:18.745] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T18:27:53.673] Executing reboot command: /bin/systemctl reboot [2026-03-20T14:46:18.841] DRY RUN: would run reboot command: /usr/bin/sudo systemctl reboot
[2026-03-19T18:27:53.682] Reboot executed (or simulated). Resetting failure counter. [2026-03-20T14:46:18.844] 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-20T15:21:15.466] 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-20T15:21:17.191] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 1/3.
[2026-03-19T18:31:25.627] In cooldown after recent reboot; skipping check. 211/600 seconds [2026-03-20T15:22:18.736] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[2026-03-19T18:32:25.631] In cooldown after recent reboot; skipping check. 271/600 seconds [2026-03-20T15:23:19.802] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 3/3.
[2026-03-19T18:33:25.644] In cooldown after recent reboot; skipping check. 331/600 seconds [2026-03-20T15:23:19.865] DRY RUN: would run reboot command: /bin/systemctl reboot
[2026-03-19T18:34:25.706] In cooldown after recent reboot; skipping check. 392/600 seconds [2026-03-20T15:23:19.867] Reboot executed (or simulated). Resetting failure counter.
[2026-03-19T18:35:25.731] In cooldown after recent reboot; skipping check. 452/600 seconds [2026-03-20T15:24:21.083] 192.168.88.1 is unreachable during cooldown. Consecutive fails: 1/3.
[2026-03-19T18:36:25.793] In cooldown after recent reboot; skipping check. 512/600 seconds [2026-03-20T15:25:22.150] 192.168.88.1 is unreachable (last result: no response). Consecutive fails: 2/3.
[2026-03-19T18:37:25.855] In cooldown after recent reboot; skipping check. 572/600 seconds

1
test_ping_result.json Normal file
View File

@@ -0,0 +1 @@
{"ok": false, "result": "no response"}