-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode2
More file actions
executable file
·61 lines (59 loc) · 1.87 KB
/
Copy pathopencode2
File metadata and controls
executable file
·61 lines (59 loc) · 1.87 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
#!/bin/bash
# OpenCode2 - Miser Gateway Management Script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "${1:-start}" in
start)
echo "🚀 Starting OpenCode2 background server..."
"$SCRIPT_DIR/start_server.sh"
;;
stop)
echo "🛑 Stopping OpenCode2 background server..."
"$SCRIPT_DIR/stop_server.sh"
;;
restart)
echo "🔄 Restarting OpenCode2 background server..."
"$SCRIPT_DIR/stop_server.sh"
sleep 1
"$SCRIPT_DIR/start_server.sh"
;;
status)
if [ -f "$SCRIPT_DIR/server.pid" ]; then
PID=$(cat "$SCRIPT_DIR/server.pid")
if kill -0 $PID 2>/dev/null; then
echo "✅ OpenCode2 server is running (PID: $PID)"
echo "🔗 Health: curl http://localhost:8787/health/live"
else
echo "❌ Server not running (stale PID file)"
fi
else
echo "❌ OpenCode2 server is not running"
fi
;;
logs)
if [ -f "$SCRIPT_DIR/server.log" ]; then
tail -f "$SCRIPT_DIR/server.log"
else
echo "❌ No log file found"
fi
;;
help|--help|-h)
echo "OpenCode2 - Miser AI Gateway Management"
echo ""
echo "Usage: $0 [command]"
echo ""
echo "Commands:"
echo " start Start the background server (default)"
echo " stop Stop the background server"
echo " restart Restart the background server"
echo " status Check server status"
echo " logs Follow server logs"
echo " help Show this help message"
echo ""
echo "Server runs on http://localhost:8787"
;;
*)
echo "❌ Unknown command: $1"
echo "Use '$0 help' for usage information"
exit 1
;;
esac