mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
always show operating system section and LastBootUpTime fix
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
8bc760855e
commit
7172d1f701
3 changed files with 118 additions and 111 deletions
|
@ -364,7 +364,18 @@ function linux_identifiers()
|
|||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stderr.on('data', function () { });
|
||||
child.waitExit();
|
||||
values.linux.LastBootUpTime = child.stdout.str.trim();
|
||||
var regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
|
||||
if (regex.test(child.stdout.str.trim())) {
|
||||
values.linux.LastBootUpTime = child.stdout.str.trim();
|
||||
} else {
|
||||
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stdin.write('date -d "@$(( $(date +%s) - $(awk \'{print int($1)}\' /proc/uptime) ))" "+%Y-%m-%d %H:%M:%S"\nexit\n');
|
||||
child.waitExit();
|
||||
if (regex.test(child.stdout.str.trim())) {
|
||||
values.linux.LastBootUpTime = child.stdout.str.trim();
|
||||
}
|
||||
}
|
||||
child = null;
|
||||
} catch (ex) { }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue