claw-subagent-service 0.0.128 → 0.0.129
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
|
@@ -223,9 +223,30 @@ start_docker() {
|
|
|
223
223
|
debug_log "openclaw 版本信息:"
|
|
224
224
|
openclaw --version 2>&1 | head -5 || true
|
|
225
225
|
|
|
226
|
+
# 检查 openclaw gateway help,确认参数格式
|
|
227
|
+
debug_log "openclaw gateway help 信息:"
|
|
228
|
+
openclaw gateway --help 2>&1 | head -20 || true
|
|
229
|
+
|
|
230
|
+
# 尝试启动,如果失败则尝试其他参数格式
|
|
231
|
+
log_info "尝试启动 openclaw gateway..."
|
|
226
232
|
nohup openclaw gateway --port "$PORT" --host 0.0.0.0 > "$log_file" 2>&1 &
|
|
227
233
|
|
|
228
|
-
|
|
234
|
+
# 等待 2 秒检查进程是否启动
|
|
235
|
+
sleep 2
|
|
236
|
+
local started_pid=$!
|
|
237
|
+
if ! ps -p "$started_pid" > /dev/null 2>&1; then
|
|
238
|
+
log_warn "进程 $started_pid 已退出,尝试其他启动方式..."
|
|
239
|
+
# 尝试不带 --host 参数
|
|
240
|
+
nohup openclaw gateway --port "$PORT" > "$log_file" 2>&1 &
|
|
241
|
+
started_pid=$!
|
|
242
|
+
sleep 2
|
|
243
|
+
if ! ps -p "$started_pid" > /dev/null 2>&1; then
|
|
244
|
+
log_error "所有启动方式均失败,请检查日志:$log_file"
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
log_info "OpenClaw 服务启动命令已发送(PID: $started_pid)"
|
|
229
250
|
log_info "日志文件: $log_file"
|
|
230
251
|
|
|
231
252
|
# 等待端口就绪
|
package/package.json
CHANGED
|
@@ -156,6 +156,27 @@ async function getOpenClawStatus(port = 18789) {
|
|
|
156
156
|
const processExists = checkProcessExists();
|
|
157
157
|
if (processExists) {
|
|
158
158
|
console.warn(`[PortChecker] 警告: openclaw 进程存在,但端口 ${port} 未监听。服务可能未正确启动或已崩溃。`);
|
|
159
|
+
// 尝试获取进程详细信息
|
|
160
|
+
try {
|
|
161
|
+
const { execSync } = require('child_process');
|
|
162
|
+
const psOutput = execSync('ps aux | grep -v grep | grep openclaw', { encoding: 'utf8', timeout: 5000 }).trim();
|
|
163
|
+
console.log(`[PortChecker] 进程详细信息:\n${psOutput}`);
|
|
164
|
+
|
|
165
|
+
// 尝试获取进程监听的端口
|
|
166
|
+
const pid = psOutput.split(/\s+/)[1];
|
|
167
|
+
if (pid) {
|
|
168
|
+
try {
|
|
169
|
+
const netstatOutput = execSync(`netstat -tlnp 2>/dev/null | grep ${pid} || ss -tlnp 2>/dev/null | grep ${pid}`, { encoding: 'utf8', timeout: 5000 }).trim();
|
|
170
|
+
if (netstatOutput) {
|
|
171
|
+
console.log(`[PortChecker] 进程 ${pid} 监听的端口:\n${netstatOutput}`);
|
|
172
|
+
}
|
|
173
|
+
} catch (e) {
|
|
174
|
+
// 忽略错误
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} catch (e) {
|
|
178
|
+
// 忽略错误
|
|
179
|
+
}
|
|
159
180
|
}
|
|
160
181
|
|
|
161
182
|
console.log(`[PortChecker] 端口 ${port} 检测为未运行`);
|