Skip to content
Permalink
Browse files

Use wget instead of ping for online detection

  • Loading branch information...
NEMS Linux
NEMS Linux committed May 1, 2019
1 parent 20936e8 commit be5f20cdc08612a07eac79b2fb17ac0cc314b927
Showing with 10 additions and 4 deletions.
  1. +10 −4 info.sh
14 info.sh
@@ -292,12 +292,18 @@ elif [[ $COMMAND == "init" ]]; then

elif [[ $COMMAND == "online" ]]; then
# Check if Github responds
online=$(ping -q -w 1 -c 1 github.com > /dev/null 2>&1 && echo 1 || echo 0)
if [[ $online == 1 ]]; then
# online=$(ping -q -w 1 -c 1 github.com > /dev/null 2>&1 && echo 1 || echo 0)
# if [[ $online == 1 ]]; then
# echo 1
# else
# Try a second time as failsafe
# ping -q -w 1 -c 1 github.com > /dev/null 2>&1 && echo 1 || echo 0
# fi
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
echo 1
else
# Try a second time as failsafe
ping -q -w 1 -c 1 github.com > /dev/null 2>&1 && echo 1 || echo 0
echo 0
fi

elif [[ $COMMAND == "socket" ]]; then

0 comments on commit be5f20c

Please sign in to comment.
You can’t perform that action at this time.