resource-manager/resource-discovery/wait_for_mongodb.sh
ipatini 68b8bc9f34 RD: Updated wait_for_mongodb.sh script and commented out liveness and readiness checks
Change-Id: I989b153f1c3df8016b838488672b30e062ef2656
2024-05-09 13:10:58 +03:00

18 lines
478 B
Bash

#!/bin/bash
# Define MongoDB connection details
if [ -z "$MONGODB_HOST" ]; then MONGODB_HOST="localhost"; fi
if [ -z "$MONGODB_PORT" ]; then MONGODB_PORT="27017"; fi
# Function to check if MongoDB is ready
wait_for_mongodb() {
echo "Waiting for MongoDB ($MONGODB_HOST:$MONGODB_PORT) to be ready..."
until nc -z $MONGODB_HOST $MONGODB_PORT
do
sleep 1
done
echo "MongoDB is up and running!"
}
# Call the function to wait for MongoDB
wait_for_mongodb