photoncloud-monorepo/testing/qemu-cluster/scripts/stop-cluster.sh

23 lines
564 B
Bash
Executable file

#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
VMS_DIR="$PROJECT_ROOT/testing/qemu-cluster/vms"
echo "Stopping PhotonCloud QEMU Test Cluster..."
# PIDファイルを使ってVMを停止
for pidfile in "$VMS_DIR"/*.pid; do
if [ -f "$pidfile" ]; then
pid=$(cat "$pidfile")
vm_name=$(basename "$pidfile" .pid)
echo "Stopping $vm_name (PID: $pid)..."
kill "$pid" 2>/dev/null || true
rm -f "$pidfile"
fi
done
echo "Cluster stopped."