mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-10-14 05:19:19 +00:00
21 lines
641 B
TypeScript
21 lines
641 B
TypeScript
import System from '../../core/utils/system/system';
|
|
import fs from 'fs/promises';
|
|
import logger from '../../core/utils/system/logger';
|
|
import path from 'path';
|
|
import paths from '../../core/utils/system/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();
|