Community discussions

MikroTik App
 
amcrs
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Fri Apr 23, 2021 6:46 am

Scripting when posts reset

Mon May 23, 2022 7:09 pm

I have a collection of scripts to perform various tasks (create a bridge, configure DHCP, configure dns, etc). I'm trying to create a master script (a script of scripts) to configure a device.

The problem I have is that when I rum the script, my session disconnects when the port changes. Which appears to be preventing the script from completing. I see that with a longer script that does the same thing (part way through when the session disconnects)

Is there a way to have a script (or series of commands) not take effect. To suspend changes taking effect until the end when all the configuration is done? In cisco that's be the difference in the running config, but I haven't found a way to do that on the Mikrotik routerOS?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Scripting when posts reset

Mon May 23, 2022 7:14 pm

1) Use MAC winbox and do not change L1/L2 settings until is the last command on script
(for example use ether5 and set ether5 on LAN bridge as the last line)
or
2) Schedule self-destructing scheduler 20 seconds after reboot for apply settings on remaining port, and reboot
 
amcrs
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Fri Apr 23, 2021 6:46 am

Re: Scripting when posts reset

Mon May 23, 2022 7:45 pm

1) Use MAC winbox and do not change L1/L2 settings until is the last command on script
(for example use ether5 and set ether5 on LAN bridge as the last line)
or
2) Schedule self-destructing scheduler 20 seconds after reboot for apply settings on remaining port, and reboot
So the answer is no, there's not a way to suspend the changes?

That's a real PITA for writing configuration scripts.

If you schedule the entire script to run at reboot, will all the changes take effect regardless?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Scripting when posts reset

Mon May 23, 2022 10:17 pm

You already have the answer: (on correct english or not...)
2) Schedule self-destructing scheduler 20 seconds after reboot for apply settings on remaining port, and reboot
I have given you very specific advice on how to do this, have been setting up devices in production, with automatic scripts, since 2007,
and have become expert enough to give you some valid suggestions... I think...

Who is online

Users browsing this forum: JDF and 27 guests