Files
clawd/bin/clawd.js
2026-04-26 23:14:03 +08:00

25 lines
609 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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'));