Ping Script, pls help

I need script:
ping 8.8.8.8 count=3 > if status=“port unreachable” do /system reboot

Help me pls guru

you don’t need a script. there is netwatch that does what you want:
http://wiki.mikrotik.com/wiki/Manual:Tools/Netwatch#Summary

I dont need script use if ping status=“timeout” or etc, need only status = “port unreachable”

Normis: How “count=3” could be applied in netwatch without script “magic” ?

i need only status=“port unreachable”, not “timeout”, not other

in linux bash this code:

#!/bin/ash
ADDRESS=“ya.ru
RESULT=“Destination Port Unreachable”
PING=$(ping $ADDRESS -c 1 | grep -E -o ‘Destination Port Unreachable’)
if [ “$RESULT” = “$PING” ]
then
echo ‘Bad, execute repair command’
fi