Hi,
can share with me how to do the script to monitor the pppoe server, when print count = 0, then to reboot the routerboard?
So when router comes up, it will still have client count=0 and will be rebootet again? Bootloop.
You should try to fix/find the problem so you do not need reboot.
As said above, you should fix whatever are the underlying issues rather than reboot.
However, here is a script that will reboot the router, if uptime is over 1 minute, and there are 0 PPPoE sessions:
{
:local upTime [/system resource get uptime]
:local weeks [:pick $upTime 0 [:find $upTime "w"]]
:set upTime [:pick $upTime ([:find $upTime "w"]+1) [:len $upTime]]
:local days [:pick $upTime 0 [:find $upTime "d"]]
:set upTime [:pick $upTime ([:find $upTime "d"]+1) [:len $upTime]]
:local hours [:pick $upTime 0 [:find $upTime ":"]]
:set upTime [:pick $upTime ([:find $upTime ":"]+1) [:len $upTime]]
:local minutes [:pick $upTime 0 [:find $upTime ":"]]
:set upTime [:pick $upTime ([:find $upTime ":"]+1) [:len $upTime]]
:local seconds $upTime
:local upSeconds [(($weeks*604800)+($days*86400)+($hours*3600)+($minutes*60)+$seconds)]
:if ($upSeconds > 60) do={
:if ([:len [/interface pppoe-server find]] = 0) do={
/system reboot
}
}
}
You can put this into the scheduler, and schedule it to run in a 1 minute interval if you want.
Uptime script stolen from here: http://forum.mikrotik.com/t/uptime-script/80070/1
thanks for you sharing.
after post i found some similar then i amended to fit what i want.
:local PppoeClient [/interface pppoe-server print count-only];
:local CompareClient 0
#:log info ($PppoeclientInfo);
:if ($PppoeClient <= $CompareClient) do={
#:log info ($PppoeclientInfo);
/system reboot
}