I’m trying to make a startup script to run and automatically change some router settings and this script works perfectly if I run it from the terminal, but if the GUI “run script” button is pressed or the scheduler runs the script, the run count increases, but the script does not complete.
{/user group set 1 skin=restech
/user group set 0 skin=customer}
{/int wireless
set 0 name=wlan1
set 1 name=wlan2} <------------------------------- With some tests, I have determined that all settings above this line apply correctly, so this is where it breaks
I actually solved my issue. It was due to the nature of the dynamic numbering system. You need print statements to cache your numbers as referable variables.
You should not (never ever!) use any print and index in your scripts. Things will break badly if items are numbered different for what ever reason. Instead of this bad code:
/int bridge port
print
remove 4,5
You should use something like this:
/int bridge port
remove [ find where interface=wlan1 ]
remove [ find where interface=wlan2 ]
I guess that meets your needs? But it will not break if wlan1 and wlan2 are not numbered 4 and 5 - in contrast to your code.
That indeed meets my needs, though in my case, the script is to fix some things that result from using a backup config for the base unit on other units (trying to simplify configuration for customer deployment). As a result of the backup file always being the same, I was not in danger of the numbers changing, but in most cases I would have been. Those commands are super useful and I’ll definitely use those going forward though. Thanks for the help!