Files
opsxshell/run.sh
T
Logan.LiandCursor 188f3556ed fix: allow closing last session tab and restore DevTools shortcut
Closing the sole remaining non-welcome tab now resets to welcome; enable Tauri devtools, menu/shortcut toggle, and copy release artifacts from CARGO_TARGET_DIR.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 01:31:20 +08:00

44 lines
952 B
Bash
Executable File

#!/bin/bash
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
PID_FILE="/tmp/opsxshell.pid"
LOG_FILE="/tmp/opsxshell.log"
echo -e "${CYAN}🦐 启动 OpsXShell...${NC}"
# 1. 清理旧进程
echo -e "${YELLOW}🧹 清理旧进程...${NC}"
pkill -f "vite" 2>/dev/null || true
pkill -f "opsxshell" 2>/dev/null || true
sleep 1
# 2. 检查依赖
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}📦 安装依赖...${NC}"
npm install
fi
# 3. 启动 Tauri 开发应用
echo -e "${GREEN}⚡ 启动 OpsXShell...${NC}"
npm run dev > "$LOG_FILE" 2>&1 &
VITE_PID=$!
echo $VITE_PID > "$PID_FILE"
# 4. 等待启动
sleep 3
echo ""
echo -e "${GREEN}🎉 OpsXShell 已启动!${NC}"
echo -e "${CYAN}📄 日志: tail -f ${LOG_FILE}${NC}"
echo -e "${CYAN}🔍 DevTools: 菜单「视图 → 开发者工具」,或 Cmd+Option+I / F12${NC}"
# 等待子进程
wait $VITE_PID 2>/dev/null || true