eworm-de / routeros-scripts

a collection of scripts for MikroTik RouterOS
GNU General Public License v3.0
1.27k stars 285 forks source link

Delay scheduled update reboot #47

Closed bharrisau closed 1 year ago

bharrisau commented 1 year ago

Ensures all devices are finished updating before any start rebooting.

eworm-de commented 1 year ago

This makes just little to no sense to me... First part of your code is dead and will never be reached, second part adds a delay on non-scheduled (immediate) update.

So what are your trying to achieve here? Note this is about downloading packages to the local device and rebooting - what "all devices" are you referencing here?

bharrisau commented 1 year ago

I'm pretty sure the logic I've got there is:

I have a bunch of systems that run the update at the same scheduled time, so they all download and install. And then reboot 5 minutes later.

eworm-de commented 1 year ago

Ah, my fault... I should not review pull requests on a smartphone display. 😝

Still the title is wrong, or at least very misleading. The script itself supports a scheduled reboot - that made me think you are changing that code path. Something like "delay non-interactive update reboot" fits better I think.

Anyway, I am not really happy with this, as it would annoy me. For example I run packages-update from telegram-chat, and an additional delay of five minutes would make things a lot worse for me.

Perhaps this should stay as-is, but there is a simple solution for you: packages-update supports running backup scripts, and you can hook in there. Just add a new script, with this content:

# provides: backup-script, order=99
:delay 5m;

(This requires a change from next branch, I am just about to add the functionality of ordering backup scripts.)

Add the magic first line ("#!rsc by RouterOS") and place it on a web server to install it as custom script. Is that something that works for you? Any thoughts?

bharrisau commented 1 year ago

Sure - that seems like a workable option when the backup ordering is released.

eworm-de commented 1 year ago

Testing with update to RouterOS 7.12beta7 and merged into main.