Skip to content

Instantly share code, notes, and snippets.

@rhamaa
Created March 27, 2022 09:17
Show Gist options
  • Save rhamaa/1108ae0013b1796819338d0f02cc1ce7 to your computer and use it in GitHub Desktop.
Save rhamaa/1108ae0013b1796819338d0f02cc1ce7 to your computer and use it in GitHub Desktop.
Script to wait for the rabbitmq service to get READY
#!/bin/sh
# wait-for-it.sh
# Script to wait for the rabbitmq service to get READY
# Usage : ./wait-for-it.sh <HOST> <PORT>
# set -e
host="$1"
port="$2"
status=1
while [ $status -gt 0 ]
do
#psql "$PG_URL" -c "\q" > /dev/null 2>&1
nc -zv $host $port > /dev/null 2>&1
status=$?
sleep 1
echo "$host:$port is unavailable - sleeping"
done
sleep 1
echo "$host:$port is up - executing command"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment