-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
67 lines (54 loc) · 1.43 KB
/
start.sh
File metadata and controls
67 lines (54 loc) · 1.43 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
echo "RF Controls Mock System - Starting..."
echo
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "Error: Python 3 is not installed or not in PATH"
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed or not in PATH"
exit 1
fi
echo "Starting Backend Server..."
cd backend
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment and install dependencies
source venv/bin/activate
pip install -r requirements.txt
echo
echo "Backend will start on http://localhost:8000"
echo "Frontend will start on http://localhost:3000"
echo
echo "Starting servers..."
echo "Press Ctrl+C to stop both servers."
echo
# Function to cleanup processes on exit
cleanup() {
echo "Stopping servers..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Start backend in background
python main.py &
BACKEND_PID=$!
# Start frontend in background
cd ../frontend
npm install
npm start &
FRONTEND_PID=$!
echo "Backend PID: $BACKEND_PID"
echo "Frontend PID: $FRONTEND_PID"
echo
echo "Both servers are running..."
echo "Open http://localhost:3000 in your browser"
echo "Press Ctrl+C to stop both servers."
# Wait for either process to finish
wait