-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·40 lines (36 loc) · 1.08 KB
/
start.sh
File metadata and controls
executable file
·40 lines (36 loc) · 1.08 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
#!/bin/bash
# Copilot Remote - persistent startup script with auto-restart
DIR="$(cd "$(dirname "$0")" && pwd)"
LOGDIR="$DIR/logs"
mkdir -p "$LOGDIR"
echo "Starting Copilot Remote servers..."
# Start API server with auto-restart
(
while true; do
echo "[$(date)] Starting API server..." >> "$LOGDIR/server.log"
cd "$DIR/server" && npx tsx src/index.ts >> "$LOGDIR/server.log" 2>&1
echo "[$(date)] API server exited, restarting in 2s..." >> "$LOGDIR/server.log"
sleep 2
done
) &
API_PID=$!
echo "API server loop PID: $API_PID"
# Start Vite dev server with auto-restart
(
while true; do
echo "[$(date)] Starting Vite dev server..." >> "$LOGDIR/vite.log"
cd "$DIR/web" && npx vite --host >> "$LOGDIR/vite.log" 2>&1
echo "[$(date)] Vite exited, restarting in 2s..." >> "$LOGDIR/vite.log"
sleep 2
done
) &
VITE_PID=$!
echo "Vite server loop PID: $VITE_PID"
echo ""
echo "Both servers starting with auto-restart."
echo "API: http://0.0.0.0:3001"
echo "Web: http://0.0.0.0:5173"
echo "Logs: $LOGDIR/"
echo ""
echo "PIDs: $API_PID $VITE_PID" > "$LOGDIR/pids"
wait