Hi all,
I have read through nearly every published script I can find and I see parts of what I need but I am struggeling with the logic to simply achieve the whole script as I need it.
Check that I am getting the static address issued to me by the ISP.
I script the PPP interface to go down, wait 5 seconds, and come back up.
Compare the issued IP to the IP address it should be.
If it is fine... finish, otherwise
Send an email once and keep testing until it is fixed.
Once it is fixed send an email once and finish.
I have got the script to reset the PPP, get and compare the IP addresses and send email if it is no the same.
The email logic is testing me...
The catch I have is only sending each email once and looping to reset every minute or so thereafter.
and....
What would happen if I am running the script every 10 minutes and the fix takes 30 minutes to do, the loop would still be running when the script is instructed to run again. Does the ROS script logic account for this or would I need to cater for that?
I would appreciate any assistance in getting this scripted.
The fact that the link would be unusable with it going up and down is not relevant, the account is a dummy test account and the routers sole function in life is to perform this test, there are no clients behind the public interface.
My script todate is:
==================================
:local staticIP "10.0.0.1"
/interface pppoe-client disable [find name="pppoe-out1"]
:delay 5
/interface pppoe-client enable [find name="pppoe-out1"]
:delay 5
:local newIP [/ip address get [find interface="pppoe-out1"] address]
:set newIP [:pick $newIP 0 ([:len $newIP]-3) ]
:if ($newIP != $staticIP) do={
/tool e-mail send to="me@mail.com" subject="Static address NOT being issued" body="\n Problem with static addresses \n\nIP $staticIP / $newIP"
}
==================================
Thank you in advance for considering my request.