chore(openclaw): skip gateway pkill by default; opt-in CLAWD_OPENCLAW_GATEWAY_PKILL=1
This commit is contained in:
@@ -497,14 +497,17 @@ class ClawClient {
|
|||||||
writeFileSync(configFile, `${JSON.stringify(config, null, 2)}\n`, 'utf8');
|
writeFileSync(configFile, `${JSON.stringify(config, null, 2)}\n`, 'utf8');
|
||||||
log.info('clawd', `openclaw config 已更新: ${newOrigin}`);
|
log.info('clawd', `openclaw config 已更新: ${newOrigin}`);
|
||||||
|
|
||||||
// 文件有变化,kill -9 openclaw-gateway,让它被 systemd --user 自动拉起
|
// 默认不再 pkill gateway(观察是否会自行重载);恢复旧行为:CLAWD_OPENCLAW_GATEWAY_PKILL=1
|
||||||
|
if (process.env.CLAWD_OPENCLAW_GATEWAY_PKILL === '1') {
|
||||||
try {
|
try {
|
||||||
execSync('pkill -9 -x openclaw-gateway', { timeout: 3000 });
|
execSync('pkill -9 -x openclaw-gateway', { timeout: 3000 });
|
||||||
log.info('clawd', 'openclaw-gateway 已终止,等待自动重启');
|
log.info('clawd', 'openclaw-gateway 已终止,等待自动重启');
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// pkill 找不到进程时返回非 0,属于正常情况(进程未运行)
|
|
||||||
log.info('clawd', 'openclaw-gateway 进程不存在,无需终止');
|
log.info('clawd', 'openclaw-gateway 进程不存在,无需终止');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.info('clawd', '已跳过 openclaw-gateway pkill(需旧行为请设 CLAWD_OPENCLAW_GATEWAY_PKILL=1)');
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.warn('clawd', `openclaw config 更新失败: ${e.message}`);
|
log.warn('clawd', `openclaw config 更新失败: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user