mirror of
https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update.git
synced 2025-07-15 08:24:37 +02:00
asdfasdf
This commit is contained in:
parent
cf5f02998a
commit
46ba86faca
1 changed files with 9 additions and 6 deletions
13
v3.rsc
13
v3.rsc
|
@ -324,6 +324,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Global variable to track current update step
|
# Global variable to track current update step
|
||||||
|
# They need to be initialized here first to be available in the script
|
||||||
|
:global buGlobalVarTargetOsVersion
|
||||||
|
|
||||||
:global buGlobalVarScriptStep
|
:global buGlobalVarScriptStep
|
||||||
:local scriptStep $buGlobalVarScriptStep
|
:local scriptStep $buGlobalVarScriptStep
|
||||||
:do {/system script environment remove buGlobalVarScriptStep} on-error={}
|
:do {/system script environment remove buGlobalVarScriptStep} on-error={}
|
||||||
|
@ -659,8 +662,7 @@
|
||||||
:local scheduledCommand (":delay 5s; /system scheduler remove BKPUPD-NEXT-BOOT-TASK; :global buGlobalVarScriptStep $nextStep; :global buGlobalVarTargetOsVersion \"$routerOsVersionAvailable\"; :delay 10s; /system script run BackupAndUpdate;")
|
:local scheduledCommand (":delay 5s; /system scheduler remove BKPUPD-NEXT-BOOT-TASK; :global buGlobalVarScriptStep $nextStep; :global buGlobalVarTargetOsVersion \"$routerOsVersionAvailable\"; :delay 10s; /system script run BackupAndUpdate;")
|
||||||
/system scheduler add name=BKPUPD-NEXT-BOOT-TASK on-event=$scheduledCommand start-time=startup interval=0
|
/system scheduler add name=BKPUPD-NEXT-BOOT-TASK on-event=$scheduledCommand start-time=startup interval=0
|
||||||
|
|
||||||
#/system package update install
|
/system package update install
|
||||||
/system reboot
|
|
||||||
} on-error={
|
} on-error={
|
||||||
# Failed to install new RouterOS version, remove the scheduled task
|
# Failed to install new RouterOS version, remove the scheduled task
|
||||||
:do {/system scheduler remove BKPUPD-NEXT-BOOT-TASK} on-error={}
|
:do {/system scheduler remove BKPUPD-NEXT-BOOT-TASK} on-error={}
|
||||||
|
@ -691,7 +693,7 @@
|
||||||
:log info "$SMP routerboard upgrade process was completed, going to reboot in a moment!";
|
:log info "$SMP routerboard upgrade process was completed, going to reboot in a moment!";
|
||||||
|
|
||||||
## Set scheduled task to send final report on the next boot, task will be deleted when it is done. (That is why you should keep original script name)
|
## Set scheduled task to send final report on the next boot, task will be deleted when it is done. (That is why you should keep original script name)
|
||||||
/system scheduler add name=BKPUPD-NEXT-BOOT-TASK on-event=":delay 5s; /system scheduler remove BKPUPD-NEXT-BOOT-TASK; :global buGlobalVarScriptStep 3; :delay 10s; /system script run BackupAndUpdate;" start-time=startup interval=0
|
/system scheduler add name=BKPUPD-NEXT-BOOT-TASK on-event=":delay 5s; /system scheduler remove BKPUPD-NEXT-BOOT-TASK; :global buGlobalVarScriptStep 3; :global buGlobalVarTargetOsVersion \"$buGlobalVarTargetOsVersion\"; :delay 10s; /system script run BackupAndUpdate;" start-time=startup interval=0
|
||||||
|
|
||||||
## Reboot system to boot with new firmware
|
## Reboot system to boot with new firmware
|
||||||
/system reboot;
|
/system reboot;
|
||||||
|
@ -703,10 +705,11 @@
|
||||||
:if ($scriptStep = 3) do={
|
:if ($scriptStep = 3) do={
|
||||||
:log info ("$SMP The script is in the third step, sending final report.")
|
:log info ("$SMP The script is in the third step, sending final report.")
|
||||||
|
|
||||||
:global buGlobalVarTargetOsVersion
|
|
||||||
:local targetOsVersion $buGlobalVarTargetOsVersion
|
:local targetOsVersion $buGlobalVarTargetOsVersion
|
||||||
:do {/system script environment remove buGlobalVarTargetOsVersion} on-error={}
|
:do {/system script environment remove buGlobalVarTargetOsVersion} on-error={}
|
||||||
|
:if ([:len $targetOsVersion] = 0) do={
|
||||||
|
:log warning "$SMP Something is wrong, the script was unable to get the target updated OS version from the global variable."
|
||||||
|
}
|
||||||
|
|
||||||
:local mailStep3Subject $mailSubjectPrefix
|
:local mailStep3Subject $mailSubjectPrefix
|
||||||
:local mailStep3Body ""
|
:local mailStep3Body ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue