This commit is contained in:
zino
2023-11-23 14:09:28 +01:00
parent 62e7b86882
commit 6816f5ba10

View File

@@ -5,7 +5,15 @@ CONTAINER_NAME="lgsm-cs"
# Function to check if the container is running
is_container_running() {
[[ "$(docker inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/dev/null)" == "true" ]]
docker inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/dev/null
}
# Function to wait for the container to be fully up and running
wait_for_container() {
echo "Waiting for container ${CONTAINER_NAME} to be fully up and running..."
while ! docker exec "${CONTAINER_NAME}" echo "Container is up" &>/dev/null; do
sleep 1
done
}
# Function to execute commands in the container
@@ -13,17 +21,11 @@ execute_in_container() {
docker exec -d "${CONTAINER_NAME}" sh -c "$1"
}
# Ensure the container is running
if ! is_container_running; then
# Check if container is running
if [ "$(is_container_running)" != "true" ]; then
echo "Container ${CONTAINER_NAME} is not running. Starting it..."
docker start "${CONTAINER_NAME}"
# Wait for the container to be up
echo "Waiting for the container to be fully up..."
until is_container_running; do
sleep 1
done
echo "Container ${CONTAINER_NAME} is now running."
wait_for_container
fi
# Moving and copying libstdc++.so.6