start.sh improvement
This commit is contained in:
13
start.sh
13
start.sh
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user