crystelf-core/src/modules/system/system.service.ts
2025-05-04 10:31:52 +08:00

21 lines
620 B
TypeScript

import System from '../../utils/core/system';
import fs from 'fs/promises';
import logger from '../../utils/core/logger';
import path from 'path';
import paths from '../../utils/core/path';
class SystemService {
public async systemRestart() {
logger.debug(`有个小可爱正在请求重启核心..`);
await System.restart();
}
public async getRestartTime() {
logger.debug(`有个小可爱想知道核心重启花了多久..`);
const restartTimePath = path.join(paths.get('temp'), 'restart_time');
return await fs.readFile(restartTimePath, 'utf8');
}
}
export default new SystemService();