【RouterOS】——怎样自己写script,reboot后都会自动行?
因为最近搞一个Dynamic DNS Script,才发现自己的写的script根本没有运行过,所以先搞好下面目标:1. 怎样写RouterOS script
2. 手动怎样运行
3. 怎样自动运行
4. 怎样关机后的script都会自动行 [i=s] 本帖最後由 角色 於 2013-9-8 18:14 編輯 [/i]
怎样写RouterOS Scripts:
[url]http://wiki.mikrotik.com/wiki/Manual:Scripting[/url]
Examples of RouterOS Scripts
[url]http://wiki.mikrotik.com/wiki/Manual:Scripting-examples[/url] 备用帖子。 难度来个Hello World!的RouterOS Script? 如果在terminal里自己edit的script,那么就是valid(黑色),如果是invalid的就是红色。
[attach]2762[/attach]
test1的script能正常run都没有,能正常使用。 怎样从Terminal Edit Script呢?[code]/system script add name=dyndns
/system script edit [/system script find name=dyndns] source[/code]script name=dyndns 原来问题在于我怎样把script放入/system script中间的过程出了问题。
[attach]2763[/attach] 现在script在Windows Editor建立后,然后我们可以把file drag到RB里files folder。估计怎样从files folder转到system script folder就要利用Terminal的command了。 How to run a script?
/import file=script.rsc
where script.rsc is the file to loaded from /file and execute How to run a script?
/import file=script.rsc
where script.rsc is the file to loaded from /file and execute 其实7#里的东西,只可以在那里edit,而不是import pre-scripted code,把你的code放在红框里就可以,如果测试成功,就可以export to file folder。 [b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=35081&ptid=5838]7#[/url] [i]角色[/i] [/b]
其实上面的/system script是用来测试输入的script(把script copy to window里),然后export出来。 可以把SCRIPT放入SCHEDULE, 再SET每幾多分鐘RUN一次, 所以SCRIPT一定要有自我測試是否需要RUN, 否則SCRIPT會不停RUN, 特別係DYNDNS,我試過被BAN個A/C, 原因係UPDATE太密. 现在问题是关机后,reboot后,WAN变了,但是DNS Server没有update!之间一定出了点问题,需要多点时间才能好好解决。 想问一下,Reboot 后是用这Script run DDNS? Reboot 到dial up, Internet Connection 起码10Sec。是在加两个Script? 一个加(Delay 10Sec) ?
/system schedule
add name=test on-event=test start-time=startup interval=0
This will run 3 seconds after bootup. See the docs under System Scheduler for more info. 改了才发现是不用的。在中国移动宽带Reboot后起码3分钟Ether1才能Stable下来。 不太明白爲什麽Ether1的IP要3分鐘才能穩定下來!還有DNS Server在update方面有限制呢?
頁:
[1]