2021-12-03

A simple script to get and file the Internet WAN IP address of your private network

xip=`/usr/bin/wget -q --read-timeout=15.0 --waitretry=5 --tries=3 http://checkip.dyndns.org -O - | /usr/bin/cut -f2 -d: | /usr/bin/cut -f1 -d"<" | /usr/bin/sed "s/\ //g"`

/usr/bin/echo $xip | /usr/bin/egrep -q [0-9,\.] && {

/usr/bin/echo /usr/bin/egrep -q $xip$ /local/etc/wanip.txt

/usr/bin/echo -n "grep response: "

/usr/bin/egrep $xip$ /local/etc/wanip.txt

/usr/bin/egrep -q $xip$ /local/etc/wanip.txt || {

        /usr/bin/wall $HOSTNAME wan IP changes $xip

        /usr/local/etc/pushovermsg $HOSTNAME wan IP changes $xip

        }

/usr/bin/echo $xip > /local/etc/wanip.txt

} ||  {

/usr/bin/echo IP found was: $xip

/usr/bin/echo no ip acquired

}

No comments:

Post a Comment

Script to see network interface connection speed

cat network-speed #!/usr/bin/bash # ethtool enp2s0 | grep Speed ethtool $1 | grep Speed # mii-tool -v enp2s0 mii-tool -v $1   network-speed ...