-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_bluetooth_system.sh
More file actions
executable file
·68 lines (55 loc) · 1.66 KB
/
start_bluetooth_system.sh
File metadata and controls
executable file
·68 lines (55 loc) · 1.66 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
68
#!/bin/bash
# Bluetooth Mesh System Startup Script
# ====================================
echo "🚀 Starting Bluetooth Mesh System"
echo "=================================="
# Check if we're in the right directory
if [ ! -f "blueQ-backend.py" ]; then
echo "❌ Please run this script from the project root directory"
exit 1
fi
# Configuration
ODIN_MAC="2C:CF:67:AE:6E:4A"
BACKEND_PORT=5000
CLIENT_MANAGER_PORT=8001
echo "📡 Odin MAC: $ODIN_MAC"
echo "🌐 Backend Port: $BACKEND_PORT"
echo "🔌 Client Manager Port: $CLIENT_MANAGER_PORT"
echo ""
# Function to kill background processes on exit
cleanup() {
echo ""
echo "🛑 Shutting down services..."
kill $(jobs -p) 2>/dev/null
wait
echo "✅ All services stopped"
exit 0
}
trap cleanup SIGINT SIGTERM
# # Start Flask Backend
echo "🌐 Starting Flask Backend..."
python3 blueQ-backend.py $BACKEND_PORT &
BACKEND_PID=$!
# Wait a moment for backend to start
sleep 3
# Start Client Manager
echo "📡 Starting Bluetooth Client Manager..."
cd web_application
python3 client_manager.py $ODIN_MAC http://localhost:$BACKEND_PORT $CLIENT_MANAGER_PORT &
CLIENT_MANAGER_PID=$!
cd ..
# Wait a moment for client manager to start
sleep 3
echo ""
echo "✅ System started successfully!"
echo ""
echo "📊 Services running:"
echo " 🌐 Flask Backend: http://localhost:$BACKEND_PORT"
echo " 📡 Client Manager API: http://localhost:$CLIENT_MANAGER_PORT/api/status"
echo " 🎯 Frontend: http://localhost:$BACKEND_PORT (if serving Angular)"
echo ""
echo "💡 New users who register will automatically connect to Bluetooth mesh"
echo " Press Ctrl+C to stop all services"
echo ""
# Wait for processes
wait