Skip to content

Commit

Permalink
Merge pull request matryer#297 from bfred-it/patch-1
Browse files Browse the repository at this point in the history
Add simple internet connection checker
  • Loading branch information
keithamus committed Mar 7, 2016
2 parents ecc668d + 9bcff36 commit 1f60577
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Network/got-internet.2s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# <bitbar.title>Got Internet?</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Federico Brigante</bitbar.author>
# <bitbar.author.github>bfred-it</bitbar.author.github>
# <bitbar.desc>Checks the connection to Internet and tells you in a single character.</bitbar.desc>
# <bitbar.image>http://i.imgur.com/I8lF8st.png</bitbar.image>

ping_timeout=1 #integers only, ping's fault
ping_address=8.8.8.8

if ! ping -c 1 -t $ping_timeout -q $ping_address > /dev/null 2>&1; then
echo "✧|color=#f23400 dropdown=false"
echo "---"
echo "You're offline"
# echo "Ping to Google DNS failed"
else
echo "✦|dropdown=false"
echo "---"
echo "You're online"
fi

0 comments on commit 1f60577

Please sign in to comment.