Created
October 29, 2012 02:50
-
-
Save codeb2cc/3971185 to your computer and use it in GitHub Desktop.
Get PPPoe IP address
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 | |
if [ `nm-tool | ack eth0 -A 5 | ack State | sed 's/ *//g' | cut -f 2 -d ':'` == "connected" ]; then | |
# Interface eth0 UP | |
: | |
else | |
# Interface eth0 DOWN. Try to restart | |
ifup eth0 | |
fi | |
URL='http://ping.codeb2cc.com?ip=' | |
# IP=$(curl -s "http://iframe.ip138.com/ic.asp" 2>&1 | ack '\[(.*)\]' --output '$1') | |
IP=$(curl -s "ifconfig.me/ip") | |
curl -s $URL$IP >& /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment