Wilcard in Scripts?

Hi,

Is there a wildcard function for Mikrotik scripts? Do you have 2 examples here?

:if ([:find $identity "AP"] != -1) do={
    /system scheduler add interval=1m name=updateSchedule on-event="/system script run updateScript" start-date=sep/02/2023 start-time=00:05:00;
} else={ 
    /system scheduler add interval=2m name=updateSchedule on-event="/system script run updateScript" start-date=sep/02/2023 start-time=00:05:00;
}

or

:global UpdateURL "sftp://mikrotik.com/routeros-*-arm.npk"

Every 1m?

this was only a test :slight_smile:

NO.

dima1002, regarding the original question - you cannot use wildcards in the fetch function.

However, it is possible to auto-update your device using the standard update function. It will detect and download the applicable packages within the chosen channel.

/system package update
set channel=stable
check-for-updates
install

The router will contact upgrade.mikrotik.com and check the latest version (https://upgrade.mikrotik.com/routeros/LATEST.7).
If there is a new version available, it will download the correct package(s) and initiate a reboot.
If there is no new version available, nothing happens.

In scheduler, auto update every night at 3am:

/system scheduler
add interval=1d name=auto-update on-event="/system package update\r\
    \nset channel=stable\r\
    \ncheck-for-updates\r\
    \ninstall" policy=read,write,policy start-date=2023-09-13 start-time=03:00:00

I would recommend against following this approach. Better use The Dude to centrally monitor, manage and update your APs and other devices.

I thought the stupidest thing someone could do is automatically update the device as soon as a new version comes out,
but I hadn’t considered the act of sharing a script that does it, just usable with copy & paste…

rextended, thank you for your rude and unhelpful answer.
As explained, I would recommend against this auto update functionality and provided an alternative.

Compared to never updating the device, a scheduled auto update would not be the worst option?

Do you provide alternatives? Could you try to at least provide helpful insights instead of just bashing users?

What is it? A competition to see who does the worst thing?
It is actually better to have an out of order peripheral than a poorly managed one which will then cause mass attacks on others.
I agree with this.
So from now on I will omit warning about the just-out self-update, so that those who are not able to manage the device correctly will sooner or later stop managing it altogether…