1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-14 12:01:52 +00:00

always show operating system section and LastBootUpTime fix

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-09-15 23:02:23 +01:00
parent 8bc760855e
commit 7172d1f701
3 changed files with 118 additions and 111 deletions

View file

@ -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();
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) { }

View file

@ -6152,7 +6152,6 @@
var sections = [], s = {};
// Operating System
if ((hardware.windows && hardware.windows.osinfo) || node.osdesc) {
var x = '';
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
@ -6236,7 +6235,6 @@
}
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software' }); }
}
// MeshAgent
if (node.agent) {

View file

@ -12018,7 +12018,6 @@
var sections = [], s = {};
// Operating System
if ((hardware.windows && hardware.windows.osinfo) || node.osdesc) {
var x = '';
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
@ -12053,7 +12052,6 @@
x += addDetailItem("Last Boot Up Time", date);
}
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software64.png'}); }
}
// MeshAgent
if (node.agent) {