mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
unattended-lte-firmware-upgrade: convert to function
This commit is contained in:
parent
e11e6b4658
commit
370d7c1a58
1 changed files with 12 additions and 9 deletions
|
@ -17,14 +17,17 @@
|
||||||
|
|
||||||
:if (($Firmware->"installed") != ($Firmware->"latest")) do={
|
:if (($Firmware->"installed") != ($Firmware->"latest")) do={
|
||||||
:log info ("Scheduling LTE firmware upgrade for interface " . $IntName . ".");
|
:log info ("Scheduling LTE firmware upgrade for interface " . $IntName . ".");
|
||||||
/ system script add name=($IntName . "-firmware-upgrade") source=("# unattended-lte-firmware-upgrade\n" . \
|
:global LTEFirmwareUpgrade do={
|
||||||
"/ system scheduler remove " . $IntName . "-firmware-upgrade;\n" . \
|
:global LTEFirmwareUpgrade;
|
||||||
"/ system script remove " . $IntName . "-firmware-upgrade;\n" . \
|
:set LTEFirmwareUpgrade;
|
||||||
"/ interface lte firmware-upgrade " . $IntName . " upgrade=yes;\n" . \
|
/ system scheduler remove ($1 . "-firmware-upgrade");
|
||||||
":log info (\"LTE firmware upgrade finished, waiting for installation before reset.\");\n" . \
|
/ interface lte firmware-upgrade $1 upgrade=yes;
|
||||||
":delay 150s;\n" . \
|
:log info ("LTE firmware upgrade finished, waiting for installation before reset.");
|
||||||
"/ interface lte at-chat " . $IntName . " input=\"AT+RESET\";");
|
:delay 150s;
|
||||||
/ system scheduler add name=($IntName . "-firmware-upgrade") \
|
/ interface lte at-chat $1 input="AT+RESET";
|
||||||
on-event=("/ system script run " . $IntName . "-firmware-upgrade;") interval=1m;
|
:log info ("Reset device, waiting to finish and reconnect.");
|
||||||
|
}
|
||||||
|
/ system scheduler add name=($IntName . "-firmware-upgrade") start-time=startup interval=2s \
|
||||||
|
on-event=(":global LTEFirmwareUpgrade; \$LTEFirmwareUpgrade \"" . $IntName . "\";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue