Skip to content

Instantly share code, notes, and snippets.

@c5e3
Created December 23, 2016 01:40
Show Gist options
  • Save c5e3/ebc3dd032e0454ed6c1b4a81e3cdf30a to your computer and use it in GitHub Desktop.
Save c5e3/ebc3dd032e0454ed6c1b4a81e3cdf30a to your computer and use it in GitHub Desktop.
#!/bin/sh
IPeth0=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
IPwlan0=$(ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
IP6eth0=$(ifconfig eth0 | awk '/inet6/{print $3}' | grep -v ^::1 | grep -v ^fe80)
IP6wlan0=$(ifconfig wlan0 | awk '/inet6/{print $3}' | grep -v ^::1 | grep -v ^fe80)
if [ -z "$IPeth0" ]
then
IPeth0="not connected"
.
fi
if [ -z "$IPwlan0" ]
then
IPwlan0="not connected"
.
fi
if [ -z "$IP6eth0" ]
then
IP6eth0="not connected"
.
fi
if [ -z "$IP6wlan0" ]
then
IP6wlan0="not connected"
.
fi
MSG="IPv4:
eth0: ${IPeth0}
wlan0: ${IPwlan0}
IPv6:
eth0: ${IP6eth0}
wlan0: ${IP6wlan0}"
/usr/local/bin/nma "pine_a64" "IP-Update" "$MSG" 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment