diff options
Diffstat (limited to 'move_containers.sh')
| -rwxr-xr-x | move_containers.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/move_containers.sh b/move_containers.sh new file mode 100755 index 0000000..7062177 --- /dev/null +++ b/move_containers.sh @@ -0,0 +1,44 @@ +#!/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! ===" |
