use 'ip route get' over 'ip addr' for interface check (#1478)

use ip route get over ip addr for interface check
This commit is contained in:
ChuckNorrison
2020-09-05 22:14:58 +02:00
committed by GitHub
parent 598ef1ab7b
commit a9261fa3aa

View File

@@ -85,7 +85,7 @@ else
fi
# get name of active interface (eth0 or wlan0)
network_active_if=$(ip addr | grep -v "lo:" | grep 'state UP' | tr -d " " | cut -d ":" -f2 | head -n 1)
network_active_if=$(ip route get 255.255.255.255 | awk -- '{print $4}' | head -n 1)
# get network traffic
# ifconfig does not show eth0 on Armbian or in a VM - get first traffic info