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