找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2790|回复: 3

[脚本] 各位大侠请进,问个脚本调试的问题..

[复制链接]
发表于 2008-8-6 20:57:10 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
首先非常感谢进来浏览和留言的朋友,大家共同进步.互相帮助一下...在此先谢过各位大兄

小弟有一问题: 怎么用脚本获取或者对比 interface 列表下 PPTP-OUT1 (VPN连接) 的状态是否在运行??
前面有 R 显示 代表运行的意思..

以下是2.9.X 脚本详解的介绍:
:if
条件选择
[admin@MikroTik]>:if(1<2) do={:put true}
true
如果条件为真,执行do={}里面的命令



我这样写,运行不了的   请问格式应该怎样??要怎么写?  

:if(/int [find name=pptp-out1] running) do={XXXXXXXXX}   我的意思是想    如果 PPTP-OUT1 在运行 执行 XXXXX命令
001.jpg
routeros
发表于 2008-8-6 21:53:44 | 显示全部楼层
monitor 里面可以查看状态
routeros
回复

使用道具 举报

发表于 2008-8-6 22:28:51 | 显示全部楼层
:local vpns
:local vpnfir
:local vpns [/interface get [/interface find name=pptp-out1] running]
:if ($vpns=false) do={
:set vpnfir [/ip fir fil get [/ip fir fil find comment=sw ] dis]
:if ($vpnfir = true) do={/ip fir fil set [/ip fir fil find comment=sw ] disabled=no }
} else {
:set vpnfir [/ip fir fil get [/ip fir fil find comment=sw ] dis]
:if ($vpnfir = false) do={/ip fir fil set [/ip fir fil find comment=sw ] disabled=yes }}


自己改吧
routeros
回复

使用道具 举报

 楼主| 发表于 2008-8-6 22:39:30 | 显示全部楼层

回复 3# 的帖子

非常感谢楼上两位的指导....找到更简单的办法了...

:if([/interface get pppoe-out1 run]) do={
在这里写ADSL运行时要执行的脚本
} else={
在这里写ADSL断开时要执行的脚本
}
pppoe-out1是ADSL的接口名
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-2 16:28 , Processed in 0.073640 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表