summaryrefslogtreecommitdiff
path: root/move_containers.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-09-16 11:30:38 +0000
committerdoc <doc@filenotfound.org>2025-09-16 11:30:38 +0000
commit5cfeb2cf156705349730bdc6ce883fd8eb22e728 (patch)
tree13758f78513ed74198d2257c11c0ef9a913725d1 /move_containers.sh
first commitHEADmaster
Diffstat (limited to 'move_containers.sh')
-rwxr-xr-xmove_containers.sh44
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! ==="