Created
December 11, 2013 21:48
-
-
Save psyllo/7919102 to your computer and use it in GitHub Desktop.
AT&T U-Verse DSL modem/router DSL status checker
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
#!/usr/bin/env bash | |
# | |
# Checks AT&T U-Verse DSL modem for DSL Up/Down status | |
# | |
# Compatibility: | |
# | |
# Works at least with the following modem/router: | |
# Manufacturer : Pace Plc | |
# Model : 3800HGV-B | |
# Software Version : 6.9.1.42-plus.tm | |
# | |
# Synopsis: | |
# | |
# Hits the admin page and scans for it for the status | |
# and returns an error code indicating what it found. | |
# | |
# Return codes: | |
# | |
# return 0 if status us "Up" | |
# return 1 if status is "Down" | |
# return > 1 if status is anything else | |
url='http://192.168.1.254' | |
matched_text=$(curl $url 2>&1 | egrep -io '>(Down|Up)<' | egrep -io '(Down|Up)') | |
if [ $? == 0 ]; then | |
echo "DSL connection '$matched_text' according to $url" | |
if [ "$matched_text" == "Up" ]; then | |
exit 0 | |
elif [ "$matched_text" == "Down" ]; then | |
exit 1 | |
fi | |
fi | |
if [ -z "$matched_text" ]; then | |
echo "Unknown status: (no status found)" | |
else | |
echo "Unknown status: '$matched_text'" | |
fi | |
echo "You might want to check the following page in your browser: $url" | |
exit 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment