From 08cadd8cdae111252794979175b5f35fd21a0aee Mon Sep 17 00:00:00 2001 From: zino Date: Thu, 23 Nov 2023 14:28:45 +0100 Subject: [PATCH] modified --- fix_gcc.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fix_gcc.sh b/fix_gcc.sh index 38fd54b..bd9fbbb 100644 --- a/fix_gcc.sh +++ b/fix_gcc.sh @@ -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..."