| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | 
							- const web = require('./src/web')
 
- const config = require('./src/config')
 
- const interval = require('./src/Interval')
 
- const robot  = require('./src/robot')
 
- const {getRustConfig} = require("./src/config");
 
- const {logger} = require("./src/utils/logger");
 
- const {exec} = require("child_process");
 
- config.init()
 
- // 启动web
 
- web.init()
 
- // 定时任务
 
- interval.init()
 
- //node关机前的一些操作
 
- // 当进程即将退出时执行一些操作
 
- process.on('exit', (code) => {
 
-     console.log(`即将退出,退出码:${code}`);
 
-     // 在这里执行清理工作
 
- });
 
- // 监听SIGINT信号(例如用户按下Ctrl+C)
 
- process.on('SIGINT', () => {
 
-     console.log('收到SIGINT信号,准备退出...');
 
-     // 在这里执行清理工作
 
-     process.exit(); // 这将触发exit事件
 
- });
 
- // 监听SIGTERM信号(通常是系统请求进程终止)
 
- process.on('SIGTERM', async () => {
 
-     console.log('收到SIGTERM信号,准备退出...');
 
-     // 关机前为了防止 node 更新,需要吧map 里面的pid 写在本地文件
 
-     await robot.closeAppAll()
 
-     // 在这里执行清理工作
 
-     process.exit(); // 这将触发exit事件
 
- });
 
- // 还可以处理未捕获的异常
 
- process.on('uncaughtException', (err) => {
 
-     console.error('捕获到未处理的异常:', err);
 
-     // 在这里执行清理工作
 
-     process.exit(1); // 非零退出码表示异常退出
 
- });
 
 
  |