Files
cli/assistant/.opencode/skills/kill-opencode/SKILL.md
2026-01-20 15:39:46 +08:00

35 lines
927 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: kill-opencode
description: 自动查找并杀死所有opencode相关的进程确保系统资源释放。
tags:
- opencode
- process-management
- automation
---
```bash
#!/bin/bash
# kill_opencode.sh - 自动杀死所有opencode进程
echo "正在查找opencode进程..."
ps aux | grep opencode | grep -v grep
if [ $? -eq 0 ]; then
echo "正在杀死所有opencode进程..."
pkill -f opencode
sleep 2
# 检查是否还有残留进程
remaining=$(ps aux | grep opencode | grep -v grep | wc -l)
if [ $remaining -gt 0 ]; then
echo "发现 $remaining 个顽固进程,使用强制杀死模式..."
pkill -9 -f opencode
fi
echo "opencode进程清理完成"
else
echo "未找到opencode进程"
fi
# 验证是否已完全清理
echo "当前opencode进程状态"
ps aux | grep opencode | grep -v grep || echo "没有运行中的opencode进程"
```