File: oci-wait-for-networking

package info (click to toggle)
openstack-cluster-installer 43.0.22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,544 kB
  • sloc: php: 19,169; sh: 18,137; ruby: 75; makefile: 31; xml: 8
file content (20 lines) | stat: -rwxr-xr-x 375 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# This scripts waits until the PXE server responds to ping requests.
# In this way, we make sure network is up.

set -e

PXE_SERVER_IP=$(cat /etc/oci/pxe-server-ip)

TRIALS=300
while ! timeout 2 ping -q -c 1 ${PXE_SERVER_IP} >/dev/null && [ "${TRIALS}" -gt 0 ] ; do
	sleep 1
	TRIALS=$(( ${TRIALS} - 1 ))
done

if [ "${TRIALS}" = 0 ] ; then
	exit 1
else
	exit 0
fi