diff --git a/src/status/main.php b/src/status/main.php index e88b137..2eb52bd 100644 --- a/src/status/main.php +++ b/src/status/main.php @@ -21,7 +21,7 @@ function stripFirstLine($text) } } # uptime -preg_match("/\s*(.+?) up (.+?), .+? user, load average: (.+?)\s*/", shell_exec("uptime"), $matches); +preg_match("/(.+?) up (.+), .+? user, load average: (.+)/", shell_exec("uptime"), $matches); $uptime = [ 'time' => $matches[1] ?? '', 'up' => $matches[2] ?? '', diff --git a/src/status/version.php b/src/status/version.php index dae0e09..f6af5e7 100644 --- a/src/status/version.php +++ b/src/status/version.php @@ -11,16 +11,19 @@ 'wget' => 'wget -V', 'nano' => 'nano --version', 'vim' => 'vim --version', - 'tar' => 'tar --version', - 'zip' => 'zip --version', 'git' => 'git --version', - 'ssh' => 'ssh -V', 'openssl' => 'openssl version', // services - 'nginx' => 'nginx -v', + 'webmin' => 'cat /etc/webmin/version', + 'virtualmin' => 'cat /usr/libexec/webmin/virtual-server/module.info | grep version', + 'logrotate' => 'cat /etc/webmin/logrotate/version', + 'ssh' => 'cat /etc/webmin/sshd/version', + 'named' => '/usr/sbin/named -v 2>&1', + 'nginx' => '/usr/local/sbin/nginx -v 2>&1', 'mysql' => 'mysql -V', 'psql' => 'psql -V', 'passenger' => 'passenger -v', + 'passenger-config' => 'passenger-config about version', // language services 'php' => 'php -v', 'php56' => 'php56 -v', @@ -36,6 +39,7 @@ 'npm' => 'npm -v', 'yarn' => 'yarn -v', 'ruby' => 'ruby -v', + 'rake' => 'rake -V', 'gem' => 'gem -v', 'go' => 'go version', 'rustc' => 'rustc -V', @@ -44,7 +48,7 @@ 'g++' => 'g++ --version', ]; foreach ($programs as $key => $value) { - preg_match('/[\d.]+/', shell_exec($value), $match); + preg_match('/[\d.]+\d+/', shell_exec($value), $match); $programs[$key] = $match[0]; } header('content-type: application/json');