Skip to content

Instantly share code, notes, and snippets.

@milan1267
Created May 17, 2013 07:49
Show Gist options
  • Save milan1267/5597574 to your computer and use it in GitHub Desktop.
Save milan1267/5597574 to your computer and use it in GitHub Desktop.
To Ping the Network
#!/bin/sh
NUMBER_OF_PING_REQUESTS=4
ROUTER_ADDRESS="192.168.0.1"
SLEEP_TIME=900
while true
do
PACKETS_RECEIVED=`ping -c $NUMBER_OF_PING_REQUESTS $ROUTER_ADDRESS | grep "received" | awk '{print $4}'`
if [ $PACKETS_RECEIVED -eq 0 ]
then
echo `date`>>Network.txt
/root/setup/init_wlan
iwconfig mlan0 key s:cloud
iwconfig mlan0 key open
iwconfig mlan0 essid "SENSOR"
dhclient mlan0
fi
sleep $SLEEP_TIME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment