From c2bf6e6bf52614c88448dd83e4035cfb65c93b40 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 13 Nov 2023 17:34:38 +0100 Subject: [PATCH] fix pgrep process in ubuntu --- pandora_console/include/functions_cron_task.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_cron_task.php b/pandora_console/include/functions_cron_task.php index 9de0520ccd..40a6e159cc 100644 --- a/pandora_console/include/functions_cron_task.php +++ b/pandora_console/include/functions_cron_task.php @@ -459,17 +459,17 @@ function cron_task_start_gotty(bool $restart_mode=true) // Check prev process running and kill it (only if port changed in setup params). if (empty($config['restart_gotty_next_cron_port']) === false) { - config_update_value('restart_gotty_next_cron_port', ''); - - $prevProcessRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'"); + $prevProcessRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."' | grep -v 'pgrep'"); if (empty($prevProcessRunning) === false) { shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'"); } + + config_update_value('restart_gotty_next_cron_port', ''); } // Check if gotty is running on the configured port. - $processRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['gotty_port']."'"); + $processRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['gotty_port']."' | grep -v 'pgrep'"); $start_proc = true;