Hello to all, I am totally new to scripting so I any help is welcome.
I have a mikrtotik routerboard 500 series. It has been setup to act as a hotspot and have also user manager. There are several common routers on attached to it in order to provide connectivity. I have successfully setup the mail and can also send mail.
Now what I need:
A script to run from start up of the router board and send 5 pings every minute to the 192.168.88.7 access point.
If all pings fail to send an email that “access point is down”.
Then when ever the connection (and only then) become functional to send me again one mail that “access point is up and running”
Then again from the start…
Something like this should work. Create a new schedule in /system scheduler that runs every minute, and paste this code into it. Change the first line so that it matches the name of the schedule. Also edit the two /tool e-mail lines further down.
:local scheduleName “mySchedule”
:local result [/ping 192.168.88.7 count=5]
:local status [/system scheduler get [find name=“$scheduleName”] comment]
:if ($result = 5 && $status != true) do={
/tool e-mail send subject=“access point is down” body=…
/system scheduler set [find name=“$scheduleName”] comment=true
} else={
:if ($result = 0 && $status != false) do={
/tool e-mail send subject=“access point is down” body=…
/system scheduler set [find name=“$scheduleName”] comment=false
}
}