aboutsummaryrefslogtreecommitdiffstats
path: root/docker/wait_for_net.sh
blob: 354e76ad314a06c3611d273fd3988c8841dc19fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

### this script is used as entrypoint of the docker container to wait for network to be up ###

IFACE="veth0 eth0"

function wait_net() {
	for i in $IFACE; do
		[[ "$(cat /sys/class/net/$i/operstate 2>/dev/null)" == "up" ]] && return 1
	done
	return 0
}

while wait_net; do
	sleep 1
done

[[ $# > 0 ]] && exec "$@"
exec /bin/bash -l