Skip to content

Commit

Permalink
fix #330 #332
Browse files Browse the repository at this point in the history
  • Loading branch information
kanreisa committed Aug 25, 2017
1 parent fd4711d commit 6036175
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions app-wui.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ const RECORDING_DATA_FILE = __dirname + '/data/recording.json';
const RECORDED_DATA_FILE = __dirname + '/data/recorded.json';
const SCHEDULER_LOG_FILE = __dirname + '/log/scheduler';

const apps = require("./processes.json").apps;

const WUI_LOG_FILE = !!process.env.pm_id ? apps[0].out_file : (__dirname + '/log/wui');
const OPERATOR_LOG_FILE = !!process.env.pm_id ? apps[1].out_file : (__dirname + '/log/operator');
const OPERATOR_PID_FILE = !!process.env.pm_id ? apps[1].pid_file : "/var/run/chinachu-operator.pid";

// Load Config
const pkg = require("./package.json");
const config = require(CONFIG_FILE);
Expand Down Expand Up @@ -55,6 +49,20 @@ if (!fs.existsSync('./data/') || !fs.existsSync('./log/') || !fs.existsSync('./w
process.exit(1);
}

const apps = require("./processes.json").apps;

const WUI_LOG_FILE = !!process.env.pm_id ? apps[0].out_file : (__dirname + '/log/wui');
const OPERATOR_LOG_FILE = !!process.env.pm_id ? apps[1].out_file : (__dirname + '/log/operator');
const OPERATOR_PID_FILE = (() => {
if (process.env.pm_id) {
const jlist = JSON.parse(child_process.execSync("pm2 jlist"));
const proc = jlist.find(_proc => _proc.name === "chinachu-operator");
return proc.pm2_env.pm_pid_path;
} else {
return "/var/run/chinachu-operator.pid";
}
})();

// SIGQUIT
process.on('SIGQUIT', () => {
setTimeout(() => {
Expand Down

0 comments on commit 6036175

Please sign in to comment.