This commit is contained in:
zino
2023-11-23 14:28:45 +01:00
parent 063351544d
commit 08cadd8cda

View File

@@ -5,7 +5,7 @@ SERVICE_NAME="lgsm-cs"
# Function to check if the container is running
is_container_running() {
[ "$(docker container inspect -f '{{.State.Status}}' "${SERVICE_NAME}")" = "running" ]
[ "$(docker container inspect -f '{{.State.Status}}' "${SERVICE_NAME}" 2>/dev/null)" = "running" ]
}
# Function to execute commands in the container
@@ -13,8 +13,13 @@ execute_in_container() {
docker-compose exec -d "${SERVICE_NAME}" sh -c "$1"
}
# Start the container using docker-compose
docker-compose up -d "${SERVICE_NAME}"
# Check if the container is already running, if not, start it
if ! is_container_running; then
echo "Container ${SERVICE_NAME} is not running. Starting it..."
docker-compose up -d "${SERVICE_NAME}"
else
echo "Container ${SERVICE_NAME} is already running."
fi
# Wait for container to be fully up and running
echo "Waiting for container ${SERVICE_NAME} to be fully up and running..."