-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
55 lines (42 loc) · 1.19 KB
/
Copy pathrun.sh
File metadata and controls
55 lines (42 loc) · 1.19 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
#!/bin/bash
PIDS=()
cleanup() {
echo -e "\n\n[System] Shutting down all processes..."
for pid in "${PIDS[@]}"; do
if kill -0 "$pid" 2>/dev/null; then
kill "$pid"
fi
done
echo "[System] All processes stopped. Exiting."
exit 0
}
trap cleanup SIGINT SIGTERM
echo "[System] Starting all API and source processes..."
if [ -f "src/main.py" ]; then
python3 src/main.py &
PIDS+=($!)
echo " -> Started src/main.py (PID: $!)"
else
echo " -> [Warning] src/main.py not found."
fi
if command -v tailscale &> /dev/null; then
echo " -> Starting Tailscale Funnel on port 8000..."
sudo tailscale funnel 8000 &
PIDS+=($!)
echo " -> Started Tailscale Funnel (PID: $!)"
else
echo " -> [Warning] tailscale command not found. Skipping funnel."
fi
if [ -f "api/api.py" ]; then
python3 api/api.py &
PIDS+=($!)
echo " -> Started api/api.py (PID: $!)"
else
echo " -> [Warning] api/api.py not found."
fi
echo " -> Starting Uvicorn server..."
uvicorn api.api:app --host 0.0.0.0 --port 8000 --reload &
PIDS+=($!)
echo " -> Started Uvicorn (PID: $!)"
echo -e "[System] All services running. Press Ctrl+C to stop everything.\n"
wait