#!/bin/bash## put -xv after bash to debug#HOSTS="www.google.com"COUNT=10echo "----------------------"#debugecho "Host to Ping -----> " $HOSTSecho "----------------------"echo "Ping to do -----> " $COUNTecho "----------------------"######for myHost in $HOSTSdo counting=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') #debug echo "Ping replied -----> " $counting ###### if [ $counting > 5 ]; thenecho "----------------------" echo "Ping Host OK ----->" $HOSTSecho "----------------------" else echo "Reboot Suricata WAN DOWN!" echo "STOP Suricata Service" sleep 3 sudo service suricata stop echo "Wait 15 seconds" sleep 15 echo "Reset ALL state" sleep 3 sudo pfctl -F state echo "Wait 10 seconds" sleep 10 echo "START Suricata Service" sleep 3 sudo service suricata startfidone