mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Fix the service runtime
- The trim is required - To prevent an error by using: ?? ''
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user