mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-14 15:23:39 +00:00
Fixed bug with systemd 'isRunning'
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1715,7 +1715,7 @@ function serviceManager()
|
|||||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
child.stdout.str = '';
|
child.stdout.str = '';
|
||||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
child.stdin.write("systemctl status " + this.name + " | grep 'Main PID:' | awk '{print $3}'\nexit\n");
|
child.stdin.write("systemctl status " + this.name + " | grep 'Main PID:' | awk 'NR==1{print $3}'\nexit\n");
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
return (parseInt(child.stdout.str.trim()) == process.pid);
|
return (parseInt(child.stdout.str.trim()) == process.pid);
|
||||||
};
|
};
|
||||||
@@ -1724,7 +1724,7 @@ function serviceManager()
|
|||||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
child.stdout.str = '';
|
child.stdout.str = '';
|
||||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
child.stdin.write("systemctl status " + this.name + " | grep 'Active:' | awk '{print $2}'\nexit\n");
|
child.stdin.write("systemctl status " + this.name + " | grep 'Active:' | awk 'NR==1{print $2}'\nexit\n");
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
return (child.stdout.str.trim() == 'active');
|
return (child.stdout.str.trim() == 'active');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user