|
@@ -36,6 +36,9 @@ function getApp(key) {
|
|
let app = {
|
|
let app = {
|
|
id: -1,
|
|
id: -1,
|
|
port: -1,
|
|
port: -1,
|
|
|
|
+ path:"",
|
|
|
|
+ programName:"",
|
|
|
|
+ strategyName:"",
|
|
childProcess: undefined,
|
|
childProcess: undefined,
|
|
nowBalance: -1,
|
|
nowBalance: -1,
|
|
messlist: [],
|
|
messlist: [],
|
|
@@ -44,6 +47,8 @@ function getApp(key) {
|
|
threadStartTime: -1,
|
|
threadStartTime: -1,
|
|
status: 0,
|
|
status: 0,
|
|
restartStatus: 0,
|
|
restartStatus: 0,
|
|
|
|
+ closeTime:0,
|
|
|
|
+ isClearance:false,
|
|
|
|
|
|
}
|
|
}
|
|
// logger.info(appMap, appMap.has(key));
|
|
// logger.info(appMap, appMap.has(key));
|
|
@@ -81,6 +86,10 @@ async function run(param) {
|
|
app.threadStatus = RobotStatus.START_PENDING
|
|
app.threadStatus = RobotStatus.START_PENDING
|
|
app.id = key
|
|
app.id = key
|
|
app.port = param.callPort
|
|
app.port = param.callPort
|
|
|
|
+ app.path = param.path
|
|
|
|
+ app.programName = param.programName
|
|
|
|
+ app.strategyName = param.strategyName
|
|
|
|
+ app.isClearance = false
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
|
|
|
|
/****
|
|
/****
|
|
@@ -259,6 +268,7 @@ async function run(param) {
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
app.childProcess = undefined
|
|
app.childProcess = undefined
|
|
app.status = 0
|
|
app.status = 0
|
|
|
|
+ app.closeTime = new Date().getTime()
|
|
});
|
|
});
|
|
app.childProcess.on('exit', (code, signal) => {
|
|
app.childProcess.on('exit', (code, signal) => {
|
|
logger.info(`子进程退出-exit,退出码: ${code}, 信号: ${signal}`);
|
|
logger.info(`子进程退出-exit,退出码: ${code}, 信号: ${signal}`);
|
|
@@ -266,6 +276,7 @@ async function run(param) {
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
app.childProcess = undefined
|
|
app.childProcess = undefined
|
|
app.status = 0
|
|
app.status = 0
|
|
|
|
+ app.closeTime = new Date().getTime()
|
|
});
|
|
});
|
|
|
|
|
|
app.childProcess.on('close', (code) => {
|
|
app.childProcess.on('close', (code) => {
|
|
@@ -274,6 +285,7 @@ async function run(param) {
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
app.childProcess = undefined
|
|
app.childProcess = undefined
|
|
app.status = 0
|
|
app.status = 0
|
|
|
|
+ app.closeTime = new Date().getTime()
|
|
});
|
|
});
|
|
app.threadStatus = RobotStatus.RUNNING
|
|
app.threadStatus = RobotStatus.RUNNING
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
@@ -301,6 +313,7 @@ async function closeApp(param) {
|
|
logger.info(`进程${pid} 杀死成功`);
|
|
logger.info(`进程${pid} 杀死成功`);
|
|
logger.info(`当前app:`, app);
|
|
logger.info(`当前app:`, app);
|
|
app.threadStatus = RobotStatus.STOP_PENDING
|
|
app.threadStatus = RobotStatus.STOP_PENDING
|
|
|
|
+ app.isClearance = false
|
|
robotStatus(app)
|
|
robotStatus(app)
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -343,7 +356,7 @@ async function searchPositions(param) {
|
|
// {"id":"375","callPort":"1111","path":"80654e330ed67df2880231a67925e984as-rust","programName":"v3.3.2_clear","strategyName":"as","checkId":"467"}
|
|
// {"id":"375","callPort":"1111","path":"80654e330ed67df2880231a67925e984as-rust","programName":"v3.3.2_clear","strategyName":"as","checkId":"467"}
|
|
var key = param.id
|
|
var key = param.id
|
|
var appName = param.path
|
|
var appName = param.path
|
|
- var checkId = param.checkId
|
|
|
|
|
|
+ var r_id = param.id
|
|
let newAppName = "4l_as_" + appName;
|
|
let newAppName = "4l_as_" + appName;
|
|
let configName = "config.json"; //配置文件
|
|
let configName = "config.json"; //配置文件
|
|
var programName = param.programName
|
|
var programName = param.programName
|
|
@@ -362,7 +375,7 @@ async function searchPositions(param) {
|
|
const asName = appPath + "/" + newAppName
|
|
const asName = appPath + "/" + newAppName
|
|
const configPath = appPath + "/" + configName
|
|
const configPath = appPath + "/" + configName
|
|
const appPort = param.callPort
|
|
const appPort = param.callPort
|
|
- const command = `sudo ${asName} --config=${configPath} --port=${appPort} --run_mode=1 --check_id=${checkId}`
|
|
|
|
|
|
+ const command = `sudo ${asName} --config=${configPath} --port=${appPort} --run_mode=1 --r_id=${r_id}`
|
|
|
|
|
|
exec(command, (error, stdout, stderr) => {
|
|
exec(command, (error, stdout, stderr) => {
|
|
if (error) {
|
|
if (error) {
|