claw-subagent-service 0.0.130 → 0.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/command/linux/start.sh
CHANGED
|
@@ -238,10 +238,19 @@ start_docker() {
|
|
|
238
238
|
cat /tmp/openclaw-help.txt | head -30
|
|
239
239
|
fi
|
|
240
240
|
|
|
241
|
+
# 检查 openclaw gateway run --help,确认 run 子命令的参数
|
|
242
|
+
log_info "检查 openclaw gateway run --help..."
|
|
243
|
+
openclaw gateway run --help > /tmp/openclaw-run-help.txt 2>&1 || true
|
|
244
|
+
if [ -f /tmp/openclaw-run-help.txt ]; then
|
|
245
|
+
log_info "openclaw gateway run help 输出:"
|
|
246
|
+
cat /tmp/openclaw-run-help.txt | head -30
|
|
247
|
+
fi
|
|
248
|
+
|
|
241
249
|
# 尝试使用正确的参数启动
|
|
242
250
|
# 注意:openclaw gateway 可能使用不同的参数名
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
# 在 Docker 环境中,使用 run 子命令前台运行,而不是后台启动
|
|
252
|
+
log_info "尝试启动: openclaw gateway run --port $PORT"
|
|
253
|
+
nohup openclaw gateway run --port "$PORT" > "$log_file" 2>&1 &
|
|
245
254
|
|
|
246
255
|
# 等待 5 秒检查进程是否启动(给更多时间)
|
|
247
256
|
sleep 5
|
package/package.json
CHANGED
|
@@ -56,10 +56,31 @@ function getCommandName(command) {
|
|
|
56
56
|
return names[command] || '未知命令';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* 检测是否在 Docker 环境(无 systemd)
|
|
61
|
+
*/
|
|
62
|
+
function isDockerEnvironment() {
|
|
63
|
+
try {
|
|
64
|
+
const fs = require('fs');
|
|
65
|
+
// 检查 /proc/1/cgroup 是否包含 docker
|
|
66
|
+
const cgroup = fs.readFileSync('/proc/1/cgroup', 'utf8');
|
|
67
|
+
return cgroup.includes('docker');
|
|
68
|
+
} catch (e) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* 使用 ServiceManager 管理服务(systemd 模式)
|
|
75
|
+
* 注意:在 Docker 环境中不应该使用 ServiceManager,因为 Docker 通常没有 systemd
|
|
61
76
|
*/
|
|
62
77
|
async function manageWithServiceManager(command) {
|
|
78
|
+
// 如果在 Docker 环境中,直接返回 null,让上层回退到脚本方式
|
|
79
|
+
if (isDockerEnvironment()) {
|
|
80
|
+
console.log('[OpenClawControl] 检测到 Docker 环境,跳过 ServiceManager,使用脚本方式');
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
63
84
|
const serviceMgr = new ServiceManager('openclaw-gateway', 'OpenClaw Gateway');
|
|
64
85
|
|
|
65
86
|
try {
|