電訊茶室's Archiver

角色 發表於 2013-9-8 18:09

【RouterOS】——怎样自己写script,reboot后都会自动行?

因为最近搞一个Dynamic DNS Script,才发现自己的写的script根本没有运行过,所以先搞好下面目标:

1. 怎样写RouterOS script
2. 手动怎样运行
3. 怎样自动运行
4. 怎样关机后的script都会自动行

角色 發表於 2013-9-8 18:09

[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]

角色 發表於 2013-9-8 18:10

备用帖子。

角色 發表於 2013-9-8 18:12

难度来个Hello World!的RouterOS Script?

角色 發表於 2013-9-8 19:16

如果在terminal里自己edit的script,那么就是valid(黑色),如果是invalid的就是红色。

[attach]2762[/attach]

test1的script能正常run都没有,能正常使用。

角色 發表於 2013-9-8 19:18

怎样从Terminal Edit Script呢?[code]/system script add name=dyndns
/system script edit [/system script find name=dyndns] source[/code]script name=dyndns

角色 發表於 2013-9-8 19:55

原来问题在于我怎样把script放入/system script中间的过程出了问题。

[attach]2763[/attach]

角色 發表於 2013-9-8 20:08

现在script在Windows Editor建立后,然后我们可以把file drag到RB里files folder。估计怎样从files folder转到system script folder就要利用Terminal的command了。

角色 發表於 2013-9-8 20:54

How to run a script?

/import file=script.rsc

where script.rsc is the file to loaded from /file and execute

角色 發表於 2013-9-8 20:58

How to run a script?

/import file=script.rsc

where script.rsc is the file to loaded from /file and execute

角色 發表於 2013-9-8 23:08

其实7#里的东西,只可以在那里edit,而不是import pre-scripted code,把你的code放在红框里就可以,如果测试成功,就可以export to file folder。

角色 發表於 2013-9-9 23:01

[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出来。

jerryzero 發表於 2013-9-19 10:16

可以把SCRIPT放入SCHEDULE, 再SET每幾多分鐘RUN一次, 所以SCRIPT一定要有自我測試是否需要RUN, 否則SCRIPT會不停RUN, 特別係DYNDNS,我試過被BAN個A/C, 原因係UPDATE太密.

角色 發表於 2013-10-9 09:17

现在问题是关机后,reboot后,WAN变了,但是DNS Server没有update!之间一定出了点问题,需要多点时间才能好好解决。

yiucsw 發表於 2015-1-5 10:54

想问一下,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.

yiucsw 發表於 2015-1-5 22:46

改了才发现是不用的。在中国移动宽带Reboot后起码3分钟Ether1才能Stable下来。

角色 發表於 2015-1-5 23:27

不太明白爲什麽Ether1的IP要3分鐘才能穩定下來!還有DNS Server在update方面有限制呢?

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.