diff --git a/app/system/resources/dashboard/system_services.php b/app/system/resources/dashboard/system_services.php index 04ccee685d..8dd860d51d 100644 --- a/app/system/resources/dashboard/system_services.php +++ b/app/system/resources/dashboard/system_services.php @@ -57,9 +57,9 @@ if (!function_exists('is_running')) { function is_running(string $name) { $name = escapeshellarg($name); - $pid = shell_exec("ps -aux | grep $name | grep -v grep | awk '{print \$2}' | head -n 1"); + $pid = trim(shell_exec("ps -aux | grep $name | grep -v grep | awk '{print \$2}' | head -n 1") ?? ''); if ($pid && is_numeric($pid)) { - $etime = shell_exec("ps -p $pid -o etime= | tr -d '\n'"); + $etime = trim(shell_exec("ps -p $pid -o etime= | tr -d '\n'") ?? ''); return ['running' => true, 'pid' => $pid, 'etime' => $etime]; } return ['running' => false, 'pid' => null, 'etime' => null];