Here is example from website of very simple bash script to check internet connection:
#!/bin/bash
WGET="/usr/bin/wget";
$WGET -q --tries=10 --timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null
if [ ! -s /tmp/index.google ];then
echo "no"
else
echo "yes"
fi
No comments:
Post a Comment