-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend_script.sh
executable file
·51 lines (39 loc) · 1.06 KB
/
backend_script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Array to hold the process IDs of the server instances
pids=()
# Function to stop all servers
stop_servers() {
echo "Stopping all servers..."
for pid in "${pids[@]}"; do
kill $pid 2>/dev/null
done
}
# Trap SIGINT (Ctrl+C) and SIGTERM signals to stop servers before exiting
trap stop_servers SIGINT SIGTERM
#start redis server
redis-server &
pids+=($!)
echo "Running Redis server"
# Start the Node.js server
npm --prefix ./app run server &
pids+=($!)
echo "Running Node.js server"
# Start the Go server
cd ./go-backend/api/
go run . &
pids+=($!)
echo "Running Go server"
cd -
# Start the Python Flask server
python3 ./python-backend/main.py &
pids+=($!)
echo "Running Python Flask server"
# Start the Spring server
cd /home/czhou578/React-Backend-Benchmarks
/usr/bin/env /usr/lib/jvm/java-17-openjdk-amd64/bin/java @/tmp/cp_64xhp6hseq0h6ede0xsi4t43y.argfile com.example.demo.DemoApplication &
pids+=($!)
echo "Running Spring server"
# Wait for all background processes to finish
wait
# Cleanup after all servers have stopped
stop_servers