#!/bin/sh

#Skrypt do sprawdzania polaczenia sieciowego


DELAY="240"
HOST="192.168.109.1"
COUNT="5"

UPTIME=$(awk '{printf "%d", $DELAY}' /proc/uptime)
[ $UPTIME -le $DELAY ] && exit 0

n=0
while [ $n -lt $COUNT ]
do
#  sleep 20
  if ping -c1 -W2 $HOST >/dev/null
  then
echo "SIEC OK"
#sprawdzam
    exit 0
  fi
  n=$((n+1))
  sleep 1
done

echo "BRAK NETA"
reboot
