diff --git a/server-console/src/main.js b/server-console/src/main.js index 9cbdc38f47..b99d1387b5 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -892,12 +892,18 @@ function onContentLoaded() { deleteOldFiles(logPath, DELETE_LOG_FILES_OLDER_THAN_X_SECONDS, LOG_FILE_REGEX); if (dsPath && acPath) { - domainServer = new Process('domain-server', dsPath, ['--get-temp-name', - '--parent-pid', process.pid], logPath); - acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n7', - '--log-directory', logPath, - '--http-status-port', httpStatusPort, - '--parent-pid', process.pid], httpStatusPort, logPath); + var dsArguments = ['--get-temp-name', + '--parent-pid', process.pid]; + domainServer = new Process('domain-server', dsPath, dsArguments, + logPath, true); + + var acArguments = ['-n7', + '--log-directory', logPath, + '--http-status-port', httpStatusPort, + '--parent-pid', process.pid]; + acMonitor = new ACMonitorProcess('ac-monitor', acPath, acArguments, + httpStatusPort, logPath, true); + homeServer = new ProcessGroup('home', [domainServer, acMonitor]); logWindow = new LogWindow(acMonitor, domainServer); diff --git a/server-console/src/modules/hf-process.js b/server-console/src/modules/hf-process.js index 1de0630a0a..af728eeda7 100644 --- a/server-console/src/modules/hf-process.js +++ b/server-console/src/modules/hf-process.js @@ -102,7 +102,7 @@ ProcessGroup.prototype = extend(ProcessGroup.prototype, { }); var ID = 0; -function Process(name, command, commandArgs, logDirectory) { +function Process(name, command, commandArgs, logDirectory, restartOnCrash) { events.EventEmitter.call(this); this.id = ++ID; @@ -113,6 +113,7 @@ function Process(name, command, commandArgs, logDirectory) { this.logDirectory = logDirectory; this.logStdout = null; this.logStderr = null; + this.restartOnCrash = restartOnCrash; this.state = ProcessStates.STOPPED; }; @@ -271,7 +272,7 @@ Process.prototype = extend(Process.prototype, { var unexpectedShutdown = this.state != ProcessStates.STOPPING; this.updateState(ProcessStates.STOPPED); - if (unexpectedShutdown) { + if (unexpectedShutdown && this.restartOnCrash) { log.warn("Child stopped unexpectedly, restarting."); this.start(); return; @@ -282,8 +283,8 @@ Process.prototype = extend(Process.prototype, { // ACMonitorProcess is an extension of Process that keeps track of the AC Montior's // children status and log locations. const CHECK_AC_STATUS_INTERVAL = 1000; -function ACMonitorProcess(name, path, args, httpStatusPort, logPath) { - Process.call(this, name, path, args, logPath); +function ACMonitorProcess(name, path, args, httpStatusPort, logPath, restartOnCrash) { + Process.call(this, name, path, args, logPath, restartOnCrash); this.httpStatusPort = httpStatusPort;