mirror of
https://github.com/LX3JL/xlxd.git
synced 2025-12-06 07:42:01 +01:00
add possibillity to query uptime via systemd
This commit is contained in:
parent
2dec160aba
commit
890e488059
|
|
@ -109,6 +109,18 @@ class xReflector {
|
||||||
else {
|
else {
|
||||||
$this->ProcessIDFile = null;
|
$this->ProcessIDFile = null;
|
||||||
$this->ServiceUptime = null;
|
$this->ServiceUptime = null;
|
||||||
|
|
||||||
|
exec('/usr/bin/systemctl show --property=ActiveEnterTimestamp xlxd.service', $out, $code);
|
||||||
|
if ($code == 0) {
|
||||||
|
if (is_array($out) && count($out) > 0) {
|
||||||
|
$out = $out[0];
|
||||||
|
}
|
||||||
|
if (is_string($out)) {
|
||||||
|
$out = explode('=', $out, 2)[1];
|
||||||
|
$out = strtotime($out);
|
||||||
|
$this->ServiceUptime = time() - $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue