1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#!/bin/sh
set -e
# Start once immediately
/usr/bin/openstack-cluster-installer-agent >>/var/log/openstack-cluster-installer-agent.log 2>&1 || true
# Contact PXE server once, anytime, during this interval
INTERVAL=30
while [ 1 ] ; do
# To avoid flooding the PXE server, the agents don't connect all
# at the same time, but once during an interval of 30 seconds.
DELAY=$(( $(dd if=/dev/urandom bs=512 count=1 2>&1 | cksum | cut -d' ' -f1) % ${INTERVAL} ))
END_COMMAND=$(( ${INTERVAL} - ${DELAY} ))
sleep ${DELAY}
/usr/bin/openstack-cluster-installer-agent >>/var/log/openstack-cluster-installer-agent.log 2>&1 || true
sleep ${END_COMMAND}
done
|