Files
HexaHost-GameCloud/scripts/dev-stop.sh
2026-07-05 14:40:57 +02:00

35 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PID_FILE="$ROOT/.logs/dev.pid"
if [[ -f "$PID_FILE" ]]; then
PID="$(cat "$PID_FILE")"
if kill -0 "$PID" 2>/dev/null; then
kill "$PID" 2>/dev/null || true
sleep 1
kill -0 "$PID" 2>/dev/null && kill -9 "$PID" 2>/dev/null || true
echo "Dev server gestoppt (PID $PID)."
else
echo "Prozess $PID läuft nicht mehr."
fi
rm -f "$PID_FILE"
else
echo "Kein Dev-Server-PID-File gefunden."
fi
# Turbo/Next/Nest Kindprozesse beenden (Ports 30003003 freigeben).
pkill -f "turbo run dev" 2>/dev/null || true
pkill -f "next dev" 2>/dev/null || true
pkill -f "nest start --watch" 2>/dev/null || true
pkill -f "tsx watch src/index.ts" 2>/dev/null || true
for port in 3000 3001 3002 3003; do
if command -v fuser >/dev/null 2>&1; then
fuser -k "${port}/tcp" 2>/dev/null || true
elif command -v lsof >/dev/null 2>&1; then
lsof -ti ":${port}" -sTCP:LISTEN 2>/dev/null | xargs -r kill -9 2>/dev/null || true
fi
done