Last active
June 24, 2024 23:34
-
-
Save sebastian13/3b05cbbbdd3326a402391e81e1a8f7af to your computer and use it in GitHub Desktop.
Revisions
-
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ set address=smtp.gmail.com [email protected] port=587 tls=starttls \ ``` /system scheduler add name=upgrade-routeros on-event=upgrade-routeros start-time=04:00:00 interval=1d add name=upgrade-firmware on-event=":delay 30s\n/system script run upgrade-firmware" start-time=startup add name=backup2mail on-event=backup2mail start-time=06:00:00 interval=4w ``` -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,24 +3,26 @@ :local BackupPassword "___"; :global Identity [ / system identity get name ]; :log info message="Creating a cloud backup and sending export compact to $recipient" # Export Compact :put "Create export compact" /export compact file=export-compact :delay 10s; # Cloud-Backup :do { :if ([ /system backup cloud print count-only ] > 0) do={ :put "Create, upload and replace cloud backup." /system backup cloud upload-file action=create-and-upload \ password=$BackupPassword replace=[ get ([ find ]->0) name ]; } else={ :put "Create a new cloud backup." /system backup cloud upload-file action=create-and-upload \ password=$BackupPassword; } } on-error={ :error "Cloud Backup failed for $Identity failed." } # Get latest Cloud-Backup Details -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 3 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,12 +14,7 @@ set address=smtp.gmail.com [email protected] port=587 tls=starttls \ ``` /system scheduler add interval=1d name=upgrade-routeros on-event=upgrade-routeros start-time=04:00:00 add interval=1d name=upgrade-firmware on-event=":delay 30s\nupgrade-firmware" start-time=startup add interval=4w name=backup2mail on-event=backup2mail start-time=06:00:00 ``` -
sebastian13 renamed this gist
Jul 8, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ ``` /tool e-mail set address=smtp.gmail.com [email protected] port=587 tls=starttls \ user=[email protected] password=___ ``` 2. Create the 3 scripts, named **backup2mail**, **upgrade-firmware**, **upgrade-routeros** -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ set address=smtp.gmail.com [email protected] port=587 tls=starttls user=\ [email protected] ``` 2. Create the 3 scripts, named **backup2mail**, **upgrade-firmware**, **upgrade-routeros** 3. Create schedulers -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 25 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,25 @@ ## Backup & Auto Upgrade Mikrotik Routers 1. Set SMTP ``` /tool e-mail set address=smtp.gmail.com [email protected] port=587 tls=starttls user=\ [email protected] ``` 2. Create the 3 scripts, named backup2mail, upgrade-firmware, upgrade-routeros 3. Create schedulers ``` /system scheduler add interval=1d name=upgrade-routeros on-event=upgrade-routeros policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jan/01/2019 start-time=\ 04:00:00 add interval=1d name=upgrade-firmware on-event=upgrade-firmware policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup add interval=4w2d name=backup2mail on-event=backup2mail policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=dec/10/2019 start-time=\ 08:00:00 ``` -
sebastian13 renamed this gist
Jul 8, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sebastian13 revised this gist
Jul 8, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ # Backup & Auto Upgrade Mikrotik Routers -
sebastian13 revised this gist
Jul 8, 2022 . No changes.There are no files selected for viewing
-
sebastian13 created this gist
Jul 8, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ :local recipient :set recipient "__@__.com" :local BackupPassword "___"; :global Identity [ / system identity get name ]; :log info message="Sending Export Compact to $recipient" /export compact file=export-compact :delay 10s; # Create Cloud-Backup :do { # we are not interested in output, but print without count-only is # required to fetch information from cloud / system backup cloud print as-value; :if ([ / system backup cloud print count-only ] > 0) do={ / system backup cloud upload-file action=create-and-upload \ password=$BackupPassword replace=[ get ([ find ]->0) name ]; } else={ / system backup cloud upload-file action=create-and-upload \ password=$BackupPassword; } } on-error={ :log error ("Failed uploading backup for " . $Identity . " to cloud."); } # Get latest Cloud-Backup Details :local backupn [/system backup cloud get 0 name ]; :local backupk [/system backup cloud get 0 secret-download-key ]; :local backupd [/system backup cloud get 0 date ]; :local backupr [/system backup cloud get 0 ros-version ]; :local backups [/system backup cloud get 0 size ]; # Send E-Mail /tool e-mail send to=$recipient \ subject="Export-Compact | $Identity" \ body="A Cloud-Backup was created for $Identity. A compact export is attached.\n\nName: $backupn \nDate: $backupd \nRouterOS: $backupr \nSize: $backups \nDownload key: $backupk \n" \ file=export-compact.rsc :delay 10s; /file remove export-compact This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ :log info "Checking firmware..."; /system routerboard :if ([get current-firmware] != [get upgrade-firmware]) do={ :log info "Updating firmware"; upgrade; # Automatic restart :delay 10s /system reboot } else={ :log info "No firmware update needed." } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ :log info message="Checking for RouterOS Updates" /system package update check-for-updates once :delay 5s; :if ( [get status] = "New version is available") do={ /system script run backup2mail /system package update install }