more error resistance
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user