check-routeros-update: remove a stale scheduler

This commit is contained in:
Christian Hesse 2025-06-02 16:12:28 +02:00
parent c3d3d61f92
commit 1f4bf9ee63

View file

@ -28,6 +28,7 @@
:global EscapeForRegEx; :global EscapeForRegEx;
:global FetchUserAgentStr; :global FetchUserAgentStr;
:global LogPrint; :global LogPrint;
:global RebootForUpdate;
:global ScriptFromTerminal; :global ScriptFromTerminal;
:global ScriptLock; :global ScriptLock;
:global SendNotification2; :global SendNotification2;
@ -62,10 +63,15 @@
$WaitFullyConnected; $WaitFullyConnected;
:if ([ :len [ /system/scheduler/find where name="_RebootForUpdate" ] ] > 0) do={ :if ([ :len [ /system/scheduler/find where name="_RebootForUpdate" ] ] > 0) do={
:if ([ :typeof $RebootForUpdate ] = "nothing") do={
$LogPrint info $ScriptName ("Found a stale scheduler for reboot, removing.");
/system/scheduler/remove "_RebootForUpdate";
} else={
$LogPrint info $ScriptName ("A reboot for update is already scheduled."); $LogPrint info $ScriptName ("A reboot for update is already scheduled.");
:set ExitOK true; :set ExitOK true;
:error false; :error false;
} }
}
$LogPrint debug $ScriptName ("Checking for updates..."); $LogPrint debug $ScriptName ("Checking for updates...");
/system/package/update/check-for-updates without-paging as-value; /system/package/update/check-for-updates without-paging as-value;