blob: fddba5e85647ec84be3b055edca9d2ffbf0f04da [file] [log] [blame]
#!/bin/sh
wait_for() {
for i in `seq 30` ; do
curl -f http://elasticsearch:9200/_cluster/health > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
if [ $# -gt 0 ] ; then
exec "$@"
fi
exit 0
fi
echo "* Waiting for Elasticsearch ($i/30)"
sleep 2
done
echo "Operation timed out" >&2
exit 1
}
wait_for "$@"