-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·40 lines (32 loc) · 917 Bytes
/
run.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
#!/bin/bash
# Function to handle termination and clean up child processes
cleanup() {
echo "Stopping servers..."
if ps -p $BACKEND_PID > /dev/null; then
kill $BACKEND_PID
fi
if ps -p $FRONTEND_PID > /dev/null; then
kill $FRONTEND_PID
fi
exit 0
}
# Trap SIGINT to ensure cleanup function is called
trap cleanup SIGINT
# Navigate to the backend directory and start the backend server
echo "Starting backend..."
cd backend
npm start &
BACKEND_PID=$!
# Navigate to the frontend directory and start the frontend server
echo "Starting frontend..."
cd ../ark-ui
npm run serve &
FRONTEND_PID=$!
# Wait for a few seconds to ensure the servers are up and running
sleep 5
# Open the default web browser to http://localhost:8080
echo "Opening web browser to http://localhost:8080"
xdg-open http://localhost:8080
# Wait for all processes to end
wait $BACKEND_PID
wait $FRONTEND_PID