Open akhepcat opened 9 years ago
echo ***************************** echo MINIMIZE THIS ACTIVE PING echo NetPi KEEPALIVE RUNNING! echo ***************************** iface=$(awk 'BEGIN { IGNORECASE=1 } /^[a-z0-9]+[ \t]+00000000/ { print $1 }' /proc/net/route) if [ -z "$iface" ] then echo "no active IPv4 interface" sleep 4 exit 1 fi gw="$(ip -4 route show route default dev $iface | cut -d\ -f3)" ping $gw
Good call! Pinging if nothing is active doesn't do much good, you are correct. I pushed your code and provided attribution to you as a comment. Thanks for the improvement! I'll roll it into the next IMG version.