From 2e7f624e1139739b0e5adf16ea90d30f2128dd5f Mon Sep 17 00:00:00 2001 From: FailedProxy Date: Fri, 27 Mar 2026 19:22:34 +0000 Subject: [PATCH] fixed container logging --- common.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/common.sh b/common.sh index d7529b6..2933947 100644 --- a/common.sh +++ b/common.sh @@ -121,12 +121,19 @@ resolve_remote_ip() { RUNNING_CONTAINERS=() stop_containers() { - [[ ${#CRITICAL_CONTAINER_NAMES[@]} -eq 0 ]] && return + + if [[ ${#CRITICAL_CONTAINER_NAMES[@]} -eq 0 ]]; then + log "No containers defined to stop" + return + fi info "Stopping containers..." RUNNING_CONTAINERS=() for c in "${CRITICAL_CONTAINER_NAMES[@]}"; do + + log "Checking container: $c" + STATUS=$(ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" \ "docker inspect -f '{{.State.Running}}' $c 2>/dev/null" || echo "false") @@ -134,12 +141,18 @@ stop_containers() { warn "Stopping $c" RUNNING_CONTAINERS+=("$c") ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" "docker stop $c" + else + log "$c already stopped" fi done } start_containers() { - [[ ${#RUNNING_CONTAINERS[@]} -eq 0 ]] && return + + if [[ ${#RUNNING_CONTAINERS[@]} -eq 0 ]]; then + log "No containers to restart" + return + fi info "Starting containers..."