core: implement postRestart

This commit is contained in:
undefined committed 2022-03-24 20:04:08 +08:00
1 parent adce12e212
commit 040205045f
3 files changed
+14 -6

No files matched your search

+8 -1
View File
@@ -1,8 +1,9 @@
import { exec } from 'child_process';
import { inspect } from 'util';
import Ajv from 'ajv';
import * as yaml from 'js-yaml';
import * as check from '../check';
import { ValidationError } from '../error';
import { BadRequestError, ValidationError } from '../error';
import {
isEmail, isPassword, isUname, validate,
} from '../lib/validator';
@@ -86,6 +87,12 @@ class SystemDashboardHandler extends SystemHandler {
async get() {
this.response.template = 'manage_dashboard.html';
}
async postRestart() {
if (!process.env.pm_cwd) throw new BadRequestError('Not launched by pm2');
exec(`pm2 reload "${process.env.name}"`);
this.back();
}
}
class SystemScriptHandler extends SystemHandler {