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

Added service.parameters() for upstart and systemd

This commit is contained in:
Bryan Roe
2021-01-29 19:42:49 -08:00
parent 13a45a1116
commit 464f756f6e
2 changed files with 28 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1630,6 +1630,20 @@ function serviceManager()
}
}
ret.status.platform = platform;
if(platform == "upstart")
{
ret.parameters = function parameters()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout._str = '';
child.stdout.on('data', function (chunk) { this._str += chunk.toString(); });
child.stdin.write('cat ' + this.conf + ' | grep "^exec " | awk \'NR==1{ gsub(/^exec /,"",$0); print $0; }\'\nexit\n');
child.waitExit();
var str = child.stdout._str.trim();
return (str.match(/(?:[^\s"]+|"[^"]*")+/g));
};
}
}
else
{
@@ -1754,6 +1768,16 @@ function serviceManager()
child.waitExit();
return (child.stdout._str);
};
ret.parameters = function parameters()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout._str = '';
child.stdout.on('data', function (chunk) { this._str += chunk.toString(); });
child.stdin.write('cat ' + this.conf + ' | grep "^ExecStart=" | awk \'NR==1{ gsub(/^ExecStart=/,"",$0); print $0; }\'\nexit\n');
child.waitExit();
var str = child.stdout._str.trim();
return (str.match(/(?:[^\s"]+|"[^"]*")+/g));
};
}
else
{