#!/usr/bin/env bash # === Config === CONTAINERS=( archivecontrol archivelist ftp hostingtoot humptydumpty teamtalk akkoma ) TARGET_POOL="infernode-pool" # === Move loop === for container in "${CONTAINERS[@]}"; do echo "=== Processing container: $container ===" echo "Stopping $container..." lxc stop "$container" --timeout=30 echo "Waiting for $container to fully shut down..." while true; do status=$(lxc info "$container" | grep "Status:" | awk '{print $2}') if [[ "$status" != "RUNNING" ]]; then echo "$container is fully stopped." break fi echo "$container still stopping... waiting 3 more seconds." sleep 3 done echo "Moving $container to pool: $TARGET_POOL" lxc move "$container" "$container" --storage "$TARGET_POOL" echo "Starting $container..." lxc start "$container" echo "=== $container moved and restarted! ===" echo done echo "=== All containers have been successfully moved and restarted! ==="