Skip to content

Instantly share code, notes, and snippets.

@mmastoras
Last active March 12, 2019 00:45
Show Gist options
  • Save mmastoras/ac53bd047d3b2e51571d1758179b6d3d to your computer and use it in GitHub Desktop.
Save mmastoras/ac53bd047d3b2e51571d1758179b6d3d to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "waiting for elasticsearch"
for i in {1..60}; do
nc_output=$(nc -zv localhost 9200 2>&1 >/dev/null)
[[ $nc_output == *"open"* ]] && break
sleep 1
echo -n "."
done
if [[ $nc_output == *"open"* ]]; then
echo 'elasticsearch up'
else
echo 'elasticseach not up and giving up'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment