Re: how to wait on network
Reply #7 –
In the end following phoenix_king_rus' suggestion I made the have-net script look like
#/bin/sh
if [ -x /usr/bin/ip -a -x /usr/bin/awk ]; then
[ "`ip route|awk '/^default/{print ($3!="")+($5!="")}'`" = "2" ] && echo "connected" && exit 0
else
for d in /sys/class/net/*;do
[ `basename $d` = lo ] && continue
[ "`cat $d/operstate`" = "up" ] && echo "connected" && exit 0
done
fi
echo "disconnected"
exit 1