帮忙改个PPPOE账号到期自动停用并踢下线的脚本
{:local nyr
:local yy ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $nyr 0 3]]+1)
:if ($yy<10) do={:set yy (0 . $yy)}
:set nyr ([:pick $nyr 7 11] . $yy . [:pick $nyr 4 6])
:local ii "0";
/ppp secret;
:foreach puse in do={
:local pcom ;
:local pnam ;
:set ii ($ii + 1)
:if ([:len $pcom] >= 8) do={
:local pcom8 [:tonum [:pick $pcom 0 8]];
:if ($pcom8>1) do={
:if ($nyr>=$pcom8) do={
/ppp secret disable ;:set ii ($ii-1);
/ppp active remove ;
:log error ("\BD\FB\D3\C3\D3\C3\BB\A7 [" . $pnam . "]");
}} else={:log error ("\B4\ED\CE\F3\B5\C4\B1\B8\D7\A2\B8\F1\CA\BD [" . $pnam . "] [" . $pcom . "]");}
} else={:log error ("\C8\D5\C6\DA\B1\B8\D7\A2\B2\BB\D7\E38\CE\BB [" . $pnam . "] [" . $pcom . "]")}}
:log warning ("\D3\D0\D0\A7\D3\C3\BB\A7\CA\FD [" . $ii . "]");
}
格式
20240101::备注
脚步支持v6 v7不兼容 请大神帮忙改下兼容v7。
v7好几个脚本都用不了 本帖最后由 47771885 于 2024-7-23 21:29 编辑
这个应该是差不多 十年前的脚本了,,看到了,那还是由我修复下吧
还是简单点 大于 7.10的版本设置 rosver 7 小于的设置为6
{
#www.routeros.cn20220323
:local nyr
:local Year
:local Month
:local Day
:local stime
:local Date
##7.10 >v=7 v< 7.10 =6
:local rosver 7
:if ($rosver = 6) do={
:set Year ([:pick $Date 7 11])
:set Month ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $Date 0 3]]+1)
:if ($Month < 10) do={
:set Month ("0" . $Month)
}
:set Day ([:pick $Date 4 6])
:set nyr ($Year . $Month . $Day)
} else={
:set Year ([:pick $Date 0 4])
:set Month ([:pick $Date 5 7])
:set Day ([:pick $Date 8 10])
:set nyr ($Year . $Month . $Day)
}
:local ii "0";
/ppp secret;
:foreach puse in do={
:local pcom ;
:local pnam ;
:set ii ($ii + 1)
:if ([:len $pcom] >= 8) do={
:local pcom8 [:tonum [:pick $pcom 0 8]];
:if ($pcom8>1) do={
:if ($nyr>=$pcom8) do={
/ppp secret disable ;:set ii ($ii-1);
/ppp active remove ;
:log error ("\BD\FB\D3\C3\D3\C3\BB\A7 [" . $pnam . "]");
}} else={:log error ("\B4\ED\CE\F3\B5\C4\B1\B8\D7\A2\B8\F1\CA\BD [" . $pnam . "] [" . $pcom . "]");}
} else={:log error ("\C8\D5\C6\DA\B1\B8\D7\A2\B2\BB\D7\E38\CE\BB [" . $pnam . "] [" . $pcom . "]")}}
:log warning ("\D3\D0\D0\A7\D3\C3\BB\A7\CA\FD [" . $ii . "]");
}
页:
[1]