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:
File diff suppressed because one or more lines are too long
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user