start.sh improvement

This commit is contained in:
Tim
2026-03-11 12:49:37 +01:00
parent 483cb4b043
commit 7c3ab76c79

View File

@@ -1,16 +1,16 @@
#!/bin/sh #!/bin/sh
LANG="C"
cleanup() { cleanup() {
trap - INT EXIT TERM
echo "[DPS] Cleaning up..." echo "[DPS] Cleaning up..."
pkill $backend_pid # pkill because subshells pgrep -P "$backend_pid" | xargs kill -TERM > /dev/null 2>&1
pkill $frontend_pid pgrep -P "$frontend_pid" | xargs kill -TERM > /dev/null 2>&1
echo "[DPS] Cleaned up..." echo "[DPS] Cleaned up..."
exit exit
} }
# Trap INT (Ctrl+C) trap cleanup INT EXIT TERM
trap cleanup INT
echo "[DPS] trapped" echo "[DPS] trapped"
cd ./00-backend cd ./00-backend
@@ -25,4 +25,5 @@ echo "[DPS] Frontend started with PID $frontend_pid"
echo "[DPS] Ctrl+C to stop" echo "[DPS] Ctrl+C to stop"
# Wait for cleanup # Wait for cleanup
wait wait $backend_pid
wait $frontend_pid