Created
May 17, 2013 07:49
-
-
Save milan1267/5597574 to your computer and use it in GitHub Desktop.
To Ping the Network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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