927 B
927 B
name, description, tags
| name | description | tags | |||
|---|---|---|---|---|---|
| kill-opencode | 自动查找并杀死所有opencode相关的进程,确保系统资源释放。 |
|
#!/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进程"