找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2995|回复: 4

[pppoe] 我编写的给pppoe计时的脚本---脚本的风采

[复制链接]
发表于 2006-9-21 11:08:29 | 显示全部楼层 |阅读模式

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

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

×
第一次编写脚本,写得很乱
这个脚本必须要求任何时候至少有一个pppoe连接,不然不好使
还有数据是保存在内存里的,要是重起了数据就没了
使用时把****换成用户名,然后加到脚本里,run。这个脚本会自动循环
:set b 0
:set c 0
:set d 0
:set e 0
:set f 0
:set t 0
:foreach i in=[/ppp active find service=pppoe] do={:set c ($c+1);:put $c;:set a [/ppp active get $i name];:put $i;:put $a;:if(($a=*****) && ($b=0)) do={:set e [:pick $i 1 2];:set *****up1 [/system clock get date];:set *****up2 [/system clock get time];:set c $****up2;:set *****up ("*****-up " . $*****up1 . " " . $*****up2);:log warning $*****up;:set b 1;:put $a}}

:while($f<5) do={:while($b=0) do={:delay 60;:foreach i in=[/ppp active find service=pppoe] do={:set a [/ppp active get $i name];:put $i;:put $a;:if(($a=*****) && ($b=0)) do={:set *****up1 [/system clock get date];:set *****up2 [/system clock get time];:set c $*****up2;:set *****up ("*****-up " . $*****up1 . " " . $*****up2);:log warning $*****up;:set b 1;:put $a}}};:while($b=1) do={:delay 60;:foreach i in=[/ppp active find service=pppoe] do={:set a [/ppp active get $i name];:put $i;:put $a;:if(($a=*****)) do={:set b 1} else={:set b 0}}};:if ($b=0) do={:set *****down1 [/system clock get date];:set *****down2 [/system clock get time];:set d $*****down2;:set *****down ("*****-down " . $*****down1 . " " . $*****down2);:log warning $*****down;:set b 0;:put $d;:put $c;:set uptime1 ($d - $c);:if ($uptime1<0s) do={:set uptime1 ($uptime1+1d)};:set e $uptime1;:log warning $e;};:set t ($t + $e);:log warning $t;:log warning end;:set c 0;}

[ 本帖最后由 cracks 于 2007-11-4 12:59 编辑 ]
routeros
 楼主| 发表于 2006-9-21 11:12:11 | 显示全部楼层
忘记说了,在log里显示
先是登陆时间,然后是登出时间,单次时间,累计时间
routeros
回复

使用道具 举报

发表于 2006-9-21 16:20:46 | 显示全部楼层
这个好啊,现在有了2。9.27应该用不上了
routeros
回复

使用道具 举报

 楼主| 发表于 2006-9-21 19:33:19 | 显示全部楼层
2.9.27能自动对pppoe拨入计时吗
routeros
回复

使用道具 举报

发表于 2007-11-4 12:58:33 | 显示全部楼层
学习..
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-10 13:51 , Processed in 0.088235 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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