You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
962 B

#!/bin/bash
# Cleanup stuck import containers on remote server
# Usage: ./scripts/cleanup-stuck-imports.sh [remote_host] [remote_user]
REMOTE_HOST="${REMOTE_HOST:-${1:-217.154.126.125}}"
REMOTE_USER="${REMOTE_USER:-${2:-root}}"
echo "Cleaning up stuck import containers on ${REMOTE_USER}@${REMOTE_HOST}..."
# Find and stop all containers running orly db import
ssh "${REMOTE_USER}@${REMOTE_HOST}" "docker ps --filter 'ancestor=silberengel/next-orly:v0.58.10' --format '{{.ID}} {{.Command}}' | grep -E 'db import|sh -c.*orly db' | awk '{print \$1}'" | while read container_id; do
if [ -n "$container_id" ]; then
echo "Stopping container: $container_id"
ssh "${REMOTE_USER}@${REMOTE_HOST}" "docker stop $container_id 2>/dev/null && docker rm $container_id 2>/dev/null" || true
fi
done
echo "Cleanup complete. Remaining orly containers:"
ssh "${REMOTE_USER}@${REMOTE_HOST}" "docker ps -a | grep orly || echo 'No orly containers found'"