forked from extern/shorewall_code
a0b42400a3
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5180 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
29 lines
372 B
Bash
Executable File
29 lines
372 B
Bash
Executable File
#!/bin/sh
|
|
|
|
#
|
|
# Determine if Interface is up
|
|
#
|
|
interface_is_up() {
|
|
[ -n "$(ip link ls dev $1 | grep -e '[<,]UP[,>]')" ]
|
|
}
|
|
|
|
case $# in
|
|
1)
|
|
timeout=60
|
|
;;
|
|
2)
|
|
timeout=$2
|
|
;;
|
|
*)
|
|
echo "usage: $(basename $0) <interface> [ <timeout> ]"
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
while [ $timeout -gt 0 ] && ! interface_is_up $1; do
|
|
sleep 1
|
|
timeout=$(( $timeout - 1 ))
|
|
done
|
|
|
|
|