-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-simple-fire-system.sh
More file actions
59 lines (49 loc) · 1.51 KB
/
start-simple-fire-system.sh
File metadata and controls
59 lines (49 loc) · 1.51 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
#!/bin/bash
echo "🚀 Starting Simple Arduino Fire Detection System"
echo "================================================"
# Check if Python is available
if ! command -v python &> /dev/null; then
echo "❌ Python not found. Please install Python 3.8+"
exit 1
fi
# Check if Node.js is available
if ! command -v npm &> /dev/null; then
echo "❌ Node.js/npm not found. Please install Node.js"
exit 1
fi
echo "🔥 Starting Arduino Fire Detection Backend..."
python simple-arduino-fire.py &
BACKEND_PID=$!
echo "⏳ Waiting for backend to start..."
sleep 3
echo "🌐 Starting Frontend..."
cd frontend
npm run dev &
FRONTEND_PID=$!
echo ""
echo "✅ Simple Arduino Fire Detection System Started!"
echo "================================================"
echo "🔥 Backend: 25 Arduino sensors monitoring forest"
echo "🌐 Frontend: http://localhost:3000/simple"
echo "📡 WebSocket: ws://localhost:8766"
echo ""
echo "🎮 HOW TO USE:"
echo "1. Open http://localhost:3000/simple"
echo "2. Click anywhere on the map to start a fire"
echo "3. Watch Arduino sensors detect the fire as it spreads"
echo "4. See real-time alerts in the sidebar"
echo ""
echo "Press Ctrl+C to stop both services"
# Function to cleanup background processes
cleanup() {
echo ""
echo "🛑 Stopping Arduino Fire Detection System..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
echo "👋 Goodbye!"
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Wait for user to stop
wait