more error resistance

This commit is contained in:
2024-08-18 11:50:07 -04:00
parent 4c2197919a
commit 7ce154ed44
2 changed files with 11 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ local function checkForUpdate()
fs.copy("startup.lua", "backup.lua")
if not string.find(update_code_text, __UPDATE_HASH) then
http.post(config.ntfy_url, "Computer #" .. tostring( os.getComputerID() ) .. "updating")
local file = fs.open("startup.lua", "w")
file.write(update_code_text)
file.close()
@@ -52,7 +53,10 @@ end
function mod.UpdateChecker()
while true do
checkForUpdate()
local status, err = pcall(checkForUpdate)
if not status and err ~= "Terminated" then
http.post(config.ntfy_url, err, {Priority = "urgent"})
end
sleep(1)
end
end