start.sh
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
00-backend/target/
|
00-backend/target/
|
||||||
01-frontend/node_modules/
|
01-frontend/node_modules/
|
||||||
|
*.log
|
||||||
@@ -33,10 +33,10 @@ Webshop-Projekt für htw saar Digitale Produktionssysteme
|
|||||||
|
|
||||||
### 🥰 Unix Systems
|
### 🥰 Unix Systems
|
||||||
|
|
||||||
- TODO: make script
|
|
||||||
```shell
|
```shell
|
||||||
|
sh start.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 🤮 Windows
|
### 🤮 Windows
|
||||||
|
|
||||||
- TODO: make script
|
- TODO: make script
|
||||||
|
|||||||
29
start.sh
Executable file
29
start.sh
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
# Function to clean up background processes on script exit
|
||||||
|
cleanup() {
|
||||||
|
echo "[DPS] Cleaning up..."
|
||||||
|
pkill $backend_pid # pkill because subshells
|
||||||
|
pkill $frontend_pid
|
||||||
|
echo "[DPS] Cleaned up..."
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Trap SIGINT (Ctrl+C)
|
||||||
|
trap cleanup SIGINT
|
||||||
|
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 indefinitely; cleanup will handle interruption
|
||||||
|
wait
|
||||||
Reference in New Issue
Block a user