diff --git a/reconnect_inet.sh b/reconnect_inet.sh index 46a4ad8..3028651 100755 --- a/reconnect_inet.sh +++ b/reconnect_inet.sh @@ -33,11 +33,11 @@ reconnect() { #echo -n "`hostname --long` reconnected at `date +\"%d.%m.%Y %H:%M:%S\"`" declare -i _number=0 - ptp_addr=`ifconfig $device 2>/dev/null | grep -e "P-[tz]-P" | cut -d":" -f3 | cut -d " " -f1` + ptp_addr="$(ip addr show $device 2>/dev/null | grep -E "^\s*inet" | awk '{print$2}')" while [ -z "$ptp_addr" ]; do [[ $_number -eq 90 ]] && break sleep 1 - ptp_addr=`ifconfig $device 2>/dev/null | grep -e "P-[tz]-P" | cut -d":" -f3 | cut -d " " -f1` + ptp_addr="$(ip addr show $device 2>/dev/null | grep -E "^\s*inet" | awk '{print$2}')" let _number++ done