1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-30 23:23:32 +00:00

Fixed init.d service issue

This commit is contained in:
Bryan Roe
2020-09-09 13:50:48 -07:00
parent e6ac052c88
commit cb364e8ec4
2 changed files with 5 additions and 4 deletions

View File

@@ -2101,7 +2101,8 @@ function serviceManager()
{
// Crash Restart is enabled, but it isn't inherently supported by INIT, so we must fake it with JS
var tmp_parameters = parameters.split('"').join('\\"');
parameters = "-exec \\\"var child; process.on('SIGTERM', function () { child.removeAllListeners('exit'); child.kill(); process.exit(); }); function start() { child = require('child_process').execFile(process.execPath, [process.argv0, \\\"" + tmp_parameters + "\\\"]); child.stdout.on('data', function (c) { }); child.stderr.on('data', function (c) { }); child.on('exit', function (status) { start(); }); } start();\\\"";
parameters = "var child; process.on('SIGTERM', function () { child.removeAllListeners('exit'); child.kill(); process.exit(); }); function start() { child = require('child_process').execFile(process.execPath, [process.argv0, " + '"' + tmp_parameters + '"' + "]); child.stdout.on('data', function (c) { }); child.stderr.on('data', function (c) { }); child.on('exit', function (status) { start(); }); } start();";
parameters = '-b64exec ' + Buffer.from(parameters).toString('base64');
}
// The following is the init.d script I wrote. Rather than having to deal with escaping the thing, I just Base64 encoded it to prevent issues.