reconnect_inet.sh: fix error in determin ip address.

This commit is contained in:
Christoph 2018-04-29 09:28:09 +02:00
parent 8d81bd8667
commit 1dbf123f47

View File

@ -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