Community discussions

MikroTik App
 
christian178
newbie
Topic Author
Posts: 48
Joined: Fri Sep 25, 2020 4:26 pm

import script after reset

Wed Oct 28, 2020 3:45 pm

Hello,

I have an Script:
/system routerboard settings
set boot-device=nand-if-fail-then-ethernet

/interface wireless
set [ find default-name=wlan1 ] adaptive-noise-immunity=ap-and-client-mode antenna-gain=0 band=5ghz-a/n/ac\
 channel-width=20/40/80mhz-XXXX country=no_country_set disable-running-check=yes disabled=no frequency=auto \
 frequency-mode=superchannel hw-retries=15 installation=any l2mtu=2290 mode=station-bridge nv2-preshared-key=xxx \
	nv2-security=enabled radio-name=NNNNNN-nutzer \
	scan-list=5180,5200,5220,5240,5260,5280,5300,5320,5500,5520,5540,5560,5580,5600,5620,5640,5660,5680,5700,5770,5790,5810,5830,5850,default \
	ssid=SSID tx-power=22 tx-power-mode=all-rates-fixed wireless-protocol=nv2-nstreme-802.11
/interface wireless nstreme
set wlan1 enable-nstreme=yes
delay 2
/interface bridge
add mtu=1500 name=bridge1 protocol-mode=none
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa2-psk group-key-update=1h management-protection=allowed \
 management-protection-key=xxx mode=dynamic-keys supplicant-identity=MikroTik \
 wpa2-pre-shared-key=xxx
/interface bridge filter
add action=accept chain=forward comment="allow PPPoE-Discovery" mac-protocol=pppoe-discovery
add action=accept chain=forward comment="allow PPPoE-Session" mac-protocol=pppoe
add action=drop chain=forward comment="Block all other"
add action=drop chain=input comment="Block all other from ether1" disabled=yes in-interface=ether1
/interface bridge port
add bridge=bridge1 interface=wlan1
add bridge=bridge1 interface=ether1
delay 2
	
/system ntp client
set enabled=yes primary-ntp=10.0.250.13 secondary-ntp=10.0.250.13
/tool graphing interface
add
/tool graphing resource
add
/system clock
set time-zone-name=Europe/Berlin
/system script
add name=txpower policy=ftp,reboot,read,write source=":global txpowerold [/interface wireless get [ find interface=wlan1 ] tx-\
    power];\r\
    \n:global txstrengthold [/interface wireless registration-table get [ find interface=wlan1 ] \
tx-signal-strength];\r\
    \n:global txregel [/interface wireless get [ find interface=wlan1 ] tx-power-mode];\r\
    \n\r\
    \nif (\$txregel = \"default\") do={\r\
    \n\t/interface wireless set [ find interface=wlan1 ] tx-power-mode=all-rates-fixed;\r\
    \n\t/interface wireless set [ find interface=wlan1 ] tx-power=20;\r\
    \n\t:log info tx-regel-angepasst;}\r\
    \nif (\$txpowerold < 23 && \$txstrengthold < -65) do={ \r\
    \n\t/interface wireless set [ find interface=wlan1 ] tx-power=(\$txpowerold + 2);\r\
    \n\t:log info tx-2-hoch;}\r\
    \nif (\$txpowerold > 6 && \$txstrengthold > -60) do={\r\
    \n\t/interface wireless set [ find interface=wlan1 ] tx-power=(\$txpowerold - 2);\r\
    \n\t:log info tx-2-weniger;}\r\
    \n\t/int bri fil ena [find];\r\
    \n:log info durchlauf;\r\
    \n"
add name=biosup policy=ftp,reboot,read,write source=":if ( [ /system routerboard get upgrade-firmware ] > [ /system routerboard get current-firmwar\
    e ] ) do={ /system routerboard upgrade; /delay 10; /system reboot; }"
/system scheduler
add interval=1d name=schedule1 on-event="/sys script run txpower;" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive \
start-date=jan/01/1970 start-time=03:00:00
add interval=1d name=schedule2 on-event="/sys script run biosup;" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive \
start-date=mar/18/2014 start-time=02:00:00
/ip dhcp-client 
add add-default-route=yes comment="" disabled=no \
    interface=bridge1 use-peer-ntp=yes
/system identity
set name="o-NNNNNN-nutzer"
/ip firewall connection tracking set enabled=no
/interface wireless set 0 disable-running-check=yes


But with "import script.rsc" The Winbox loose Connection and the Script will not work till the end. Why?
eth-Link goes down/up. That's the reason, why the Winbox lost connection.
Why?

best regards
Christian
 
User avatar
igoriglesias
just joined
Posts: 5
Joined: Fri Apr 27, 2018 9:06 pm
Location: Brazil
Contact:

Re: import script after reset

Wed Oct 28, 2020 4:46 pm

Hi,

Select all lines, copy and past on terminal.

Probably something in your script is wrong, when you post it on terminal you will see what lines are wrong.


Bye.

Who is online

Users browsing this forum: No registered users and 8 guests