How to reboot Mikrotik if ping failed

Let’s write script that reboot mikrotik device if no ping to gateway.

First of all lets go to menu System -> Script in Winbox and create new script with name PingCheck

Write this core in field Source:

:if ([/ping 10.21.2.1 count=10] = 0) do={
     /system reboot
}

Don’t forget to change IP 10.21.2.1 to yours gateway IP address.

Now lets create scheduler that will start this script every 10 minutes. Go to menu System -> Scheduler and create new task:

Write some name of new task, set start date Jan/01/1970, time 00:00:00 and run interval 00:10:00. Don’t forget to write script name PingCheck in field On Event.

That’s all.

One thought on “How to reboot Mikrotik if ping failed”

  1. This really is an extremely good post. In thought I would like to put in spot writing like this moreover – spending time and actual effort to create a very good article but exactly what do I say I procrastinate alot by way of no indicates appear to get something accomplished.

Leave a Reply

Your email address will not be published. Required fields are marked *