- Add hasWiredInternetProbe and export; AP mode uses it with hasInternet - systemd-env: strip NOTIFY_SOCKET from env early; client uses unix_dgram - Strip NOTIFY_SOCKET from frpc/ttyd spawn env in watchdog and frpc - WS: pong miss debounce; AP net monitor consecutive-fail debounce Made-with: Cursor
25 lines
609 B
JavaScript
25 lines
609 B
JavaScript
#!/usr/bin/env node
|
||
'use strict';
|
||
|
||
// 先于其它模块:摘掉 NOTIFY_SOCKET,避免任意子进程误发 systemd notify
|
||
require('../lib/systemd-env');
|
||
|
||
const { ClawClient } = require('../lib/client');
|
||
const log = require('../lib/logger');
|
||
|
||
const client = new ClawClient();
|
||
client.start();
|
||
|
||
let stopping = false;
|
||
|
||
function shutdown(signal) {
|
||
if (stopping) return;
|
||
stopping = true;
|
||
log.info('clawd', `收到 ${signal},正在停止...`);
|
||
client.stop();
|
||
setTimeout(() => process.exit(0), 500);
|
||
}
|
||
|
||
process.on('SIGINT', () => shutdown('SIGINT'));
|
||
process.on('SIGTERM', () => shutdown('SIGTERM'));
|