30 lines
686 B
Bash
Executable File
30 lines
686 B
Bash
Executable File
#!/bin/sh
|
|
LANG="C"
|
|
|
|
cleanup() {
|
|
trap - INT EXIT TERM
|
|
echo "[DPS] Cleaning up..."
|
|
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 cleanup INT EXIT TERM
|
|
echo "[DPS] trapped"
|
|
|
|
cd ./00-backend
|
|
( java -jar target/webshop-0.0.1-SNAPSHOT.jar 2>&1 | tee ../backend_latest.log ) &
|
|
backend_pid=$!
|
|
echo "[DPS] Backend started with PID $backend_pid"
|
|
|
|
cd ../01-frontend
|
|
( npm start 2>&1 | tee ../frontend_latest.log ) &
|
|
frontend_pid=$!
|
|
echo "[DPS] Frontend started with PID $frontend_pid"
|
|
|
|
echo "[DPS] Ctrl+C to stop"
|
|
# Wait for cleanup
|
|
wait $backend_pid
|
|
wait $frontend_pid
|