119 lines
1.8 KiB
Markdown
119 lines
1.8 KiB
Markdown
#deepseek #dsh #deepseek-harness #web #profile #tmux
|
|
## 快速启动
|
|
|
|
### 基础命令 - 后台运行
|
|
|
|
```bash
|
|
tmux new-session -d -s dsh "dsh web"
|
|
```
|
|
|
|
### 查看会话
|
|
|
|
```bash
|
|
# 列出所有 tmux 会话
|
|
tmux ls
|
|
|
|
# 连接到 dsh 会话
|
|
tmux attach -t dsh
|
|
```
|
|
|
|
### 停止服务
|
|
|
|
```bash
|
|
# 中止会话
|
|
tmux kill-session -t dsh
|
|
|
|
# 或者连接后按 Ctrl+C
|
|
tmux attach -t dsh
|
|
# 然后按 Ctrl+C
|
|
```
|
|
|
|
---
|
|
|
|
## 进阶用法
|
|
|
|
### 指定工作目录启动
|
|
|
|
```bash
|
|
tmux new-session -d -s dsh -c /path/to/dsh "dsh web"
|
|
```
|
|
|
|
### 创建多窗口配置
|
|
|
|
```bash
|
|
# 创建会话
|
|
tmux new-session -d -s dsh -c /path/to/dsh
|
|
|
|
# 发送启动命令
|
|
tmux send-keys -t dsh "dsh web" Enter
|
|
|
|
# 创建新窗口用于日志查看
|
|
tmux new-window -t dsh -n logs
|
|
tmux send-keys -t dsh:logs "tail -f dsh.log" Enter
|
|
```
|
|
|
|
### 一键启动脚本
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
# save as: start-dsh.sh
|
|
|
|
SESSION="dsh"
|
|
|
|
# 检查会话是否已存在
|
|
if tmux has-session -t $SESSION 2>/dev/null; then
|
|
echo "Session $SESSION already exists"
|
|
tmux attach -t $SESSION
|
|
else
|
|
# 创建新会话
|
|
tmux new-session -d -s $SESSION "dsh web"
|
|
echo "Session $SESSION started"
|
|
sleep 1
|
|
tmux attach -t $SESSION
|
|
fi
|
|
```
|
|
|
|
使用方式:
|
|
|
|
```bash
|
|
chmod +x start-dsh.sh
|
|
./start-dsh.sh
|
|
```
|
|
|
|
---
|
|
|
|
## 常用快捷键 (在 tmux 内)
|
|
|
|
|快捷键|说明|
|
|
|---|---|
|
|
|`Ctrl+b d`|分离会话(后台继续运行)|
|
|
|`Ctrl+b [`|进入滚动模式查看历史|
|
|
|`q`|退出滚动模式|
|
|
|`Ctrl+c`|停止当前运行的命令|
|
|
|
|
---
|
|
|
|
## 故障排除
|
|
|
|
### 查看 web 服务日志
|
|
|
|
```bash
|
|
# 如果已启动
|
|
tmux capture-pane -t dsh -p
|
|
|
|
# 或者进入会话查看
|
|
tmux attach -t dsh
|
|
```
|
|
|
|
### 清理僵尸会话
|
|
|
|
```bash
|
|
tmux kill-session -t dsh
|
|
```
|
|
|
|
### 检查端口占用
|
|
|
|
```bash
|
|
# 默认端口检查(根据实际调整)
|
|
lsof -i :8080
|
|
``` |