Community discussions

MikroTik App
 
brodie7838
just joined
Topic Author
Posts: 18
Joined: Thu Oct 20, 2011 5:10 pm

Script works fine but won't run on startup

Mon Dec 04, 2023 7:29 pm

Device: LtAP LTE6
rOS: 7.12.1

I want to disable wlan1 on startup for a period of time. The script itself works perfectly when I run it manually:
{/interface/set wlan1 disabled=yes
:delay 30s;
/interface/set wlan1 disabled=no}
But on startup wlan1 is not disabled as expected. The script has read & write permissions, and same for the scheduler. 'script-time' is 'startup' and 'interval' is '0' as per rOS documentation. I have tried both setting scheduler to simply reference the script itself, and also set the script in scheduler directly, but neither work. The script will show 1 run and there are no log entries to review. I'm sure I'm missing something obvious here.
[admin@LTE] > system scheduler/export
/system scheduler
add name=WiFiDelay on-event="{/interface/set wlan1 disabled=yes\r\
    \n:delay 30s;\r\
    \n/interface/set wlan1 disabled=no}" policy=read,write start-time=startup
OR
[admin@LTE] > system scheduler/export
/system scheduler
add name=WiFiDelay on-event="/system script run \"WiFiDelay\"" policy=read,write start-time=startup

[admin@LTE] > system script/export 
/system script
add dont-require-permissions=no name=WiFiDelay owner=admin policy=read,write source="{/interface/set wlan1 disabled=yes\r\
    \n:delay 30s;\r\
    \n/interface/set wlan1 disabled=no}"
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12014
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script works fine but won't run on startup

Tue Dec 05, 2023 5:25 pm

the obvious:
add at least 30 seconds of delay (as first line) for wifi driver to startup the device, or when is run wifi is not ready for nothing...
 
brodie7838
just joined
Topic Author
Posts: 18
Joined: Thu Oct 20, 2011 5:10 pm

Re: Script works fine but won't run on startup

Thu Dec 07, 2023 4:37 am

Thanks Rextended, that did the trick - got it down to 2s initial delay post-startup and now it runs as expected.

Who is online

Users browsing this forum: No registered users and 5 guests