mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: implement postRestart
This commit is contained in:
1 parent
adce12e212
commit
040205045f
3 files changed
+14
-6
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user