#!/bin/bash

########################################
#
# Netzwerkverbindung prüfen
#
########################################

FAILURE=3

ping -c4 1.1.1.1 | tee /tmp/nwrep && ((FAILURE--)) && printf "\n\n" | tee -a /tmp/nwrep
sleep 0.5
ping -c4 infosnow.ch | tee -a /tmp/nwrep && ((FAILURE--)) && printf "\n\n" | tee -a /tmp/nwrep
sleep 0.5
ping -c4 google.com | tee -a /tmp/nwrep && ((FAILURE--))
echo "$FAILURE" | tee /home/snowtv/bin/nwstate
exit 0
