echo fix in common.sh
This commit is contained in:
@@ -138,13 +138,13 @@ stop_containers() {
|
|||||||
for c in "${CRITICAL_CONTAINER_NAMES[@]}"; do
|
for c in "${CRITICAL_CONTAINER_NAMES[@]}"; do
|
||||||
[[ -z "$c" ]] && continue
|
[[ -z "$c" ]] && continue
|
||||||
|
|
||||||
log "Checking container: $c"
|
info "Checking $c..."
|
||||||
|
|
||||||
STATUS=$(ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" \
|
STATUS=$(ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" \
|
||||||
"docker inspect -f '{{.State.Running}}' $c 2>/dev/null" 2>/dev/null || echo "false")
|
"docker inspect -f '{{.State.Running}}' $c 2>/dev/null" 2>/dev/null || echo "false")
|
||||||
|
|
||||||
if [[ "$STATUS" == "true" ]]; then
|
if [[ "$STATUS" == "true" ]]; then
|
||||||
warn "$ICON_STOP Stopping $c"
|
echo "$ICON_STOP Stopping $c..."
|
||||||
RUNNING_CONTAINERS+=("$c")
|
RUNNING_CONTAINERS+=("$c")
|
||||||
|
|
||||||
if ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" "docker stop $c" >/dev/null; then
|
if ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" "docker stop $c" >/dev/null; then
|
||||||
@@ -153,7 +153,7 @@ stop_containers() {
|
|||||||
error "Failed to stop $c"
|
error "Failed to stop $c"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "$c already stopped or not found"
|
warn "$c is not running, skipping"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,6 @@ start_containers() {
|
|||||||
for c in "${RUNNING_CONTAINERS[@]}"; do
|
for c in "${RUNNING_CONTAINERS[@]}"; do
|
||||||
[[ -z "$c" ]] && continue
|
[[ -z "$c" ]] && continue
|
||||||
|
|
||||||
# Check if this container needs a delay before starting
|
|
||||||
local needs_delay=false
|
local needs_delay=false
|
||||||
for d in "${DELAYED_CONTAINERS[@]}"; do
|
for d in "${DELAYED_CONTAINERS[@]}"; do
|
||||||
if [[ "$c" == "$d" ]]; then
|
if [[ "$c" == "$d" ]]; then
|
||||||
@@ -179,11 +178,11 @@ start_containers() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$needs_delay" == true ]]; then
|
if [[ "$needs_delay" == true ]]; then
|
||||||
info "Delaying start of $c by ${CONTAINER_DELAY}s..."
|
info "Waiting ${CONTAINER_DELAY}s before starting $c..."
|
||||||
sleep "$CONTAINER_DELAY"
|
sleep "$CONTAINER_DELAY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Starting $c"
|
echo "$ICON_RUN Starting $c..."
|
||||||
if ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" "docker start $c" >/dev/null; then
|
if ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" "docker start $c" >/dev/null; then
|
||||||
success "$c started"
|
success "$c started"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user