Community discussions

MikroTik App
 
djvabe
just joined
Topic Author
Posts: 13
Joined: Mon Jan 30, 2023 9:51 pm

Script that runs every 30 days at startup

Wed Feb 01, 2023 5:53 pm

Hello everyone!

I want to ask for help again.
How can I write a script that runs every 30 days when the device is started?

There is a specific router that is turned off every day in the evening and the task would be to run the bios update every 30 days in the morning when it is turned on.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Script that runs every 30 days at startup

Wed Feb 01, 2023 10:20 pm

1. Why turn of router?
2. Bios Update = New Router OS? RouterOS should never ever be auto updated. Alt least not without some control of holding it back until you are 100% sure some thing does not break.


----------------------------------------------------------------------------------------
Use Splunk> to log/monitor your MikroTik Router(s). See link below. :mrgreen:

MikroTik->Splunk
Last edited by Jotne on Sun Feb 12, 2023 9:49 pm, edited 1 time in total.
 
djvabe
just joined
Topic Author
Posts: 13
Joined: Mon Jan 30, 2023 9:51 pm

Re: Script that runs every 30 days at startup

Wed Feb 01, 2023 11:00 pm

Business premises that are rented and unfortunately the contract states that it is mandatory to turn off the electricity after closing.
And Yes, it is about automating router OS Update.
Until now, it has been like this for years, only because of certain decisions here in Hungary, now this is the new thing, that we reduce the current to everything. But that's politics that we shouldn't get involved in, just adapt :)
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script that runs every 30 days at startup

Thu Feb 02, 2023 1:19 am

Do not mix BIOS (RouterBOOT) update that happen automatically on (re)boot if on system routerboard auto-upgrade is set to yes (and the next day the bios is already updated on this way)
with the RouterOS update that can be scheduled to check after 2 minutes that the RouterBOARD has booted (at this time is supposed to be time syncronized) if is the 28th of the month, and eventually download and install automatically the new RouterOS.

What can go wrong, except the stupidity to update with a RouterOS that have at least less than 6 month, on production, is that the user, thinking that the router is blocked, power off the device during the update, and often the user is more stupid than who wants the RouterOS updated at the just coming out version, on production...
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Script that runs every 30 days at startup

Thu Feb 02, 2023 8:10 am

Just read the announcements of new RouterOS version here at the forum, and you see why an auto upgrade is dangerous.
Nearly every new version breaks some for some user/routers, but not for all. One day it may be some config you are using that breaks.

Here is one way to do an auto upgrade.

1. Make a script (that runs at boot or once a day/week) that test an external website for true/fals. As long as website says false, stop stript.
2. Test the new version on a 100% equal router that you have with same config for some time to see if all works as expected.
3. Read forum over and over for minimum some weeks.
4. Then if all looks fine, set website to true, so that upgrade will take place.


----------------------------------------------------------------------------------------
Use Splunk> to log/monitor your MikroTik Router(s). See link below. :mrgreen:

MikroTik->Splunk


----------------------------------------------------------------------------------------
Use Splunk> to log/monitor your MikroTik Router(s). See link below. :mrgreen:

MikroTik->Splunk

Who is online

Users browsing this forum: JDF and 19 guests