From 890e4880594a526d12cee27e6e45683e32bece6a Mon Sep 17 00:00:00 2001 From: Fabian Franz Date: Sun, 9 Jun 2024 12:14:40 +0200 Subject: [PATCH] add possibillity to query uptime via systemd --- dashboard/pgs/class.reflector.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php index 099599c..9bf1f8c 100755 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -109,6 +109,18 @@ class xReflector { else { $this->ProcessIDFile = 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; + } + } } }