Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ class Controller extends CI_Controller
*/
public $debug = true;

/**
* Filter path when search PID
* true: check the path
* false: ignore path (as default in 1.0.0 and 1.0.1)
*
* @var boolean
*/
public $psPathFilter = false;

/**
* Log file path
*
Expand Down Expand Up @@ -347,10 +356,15 @@ public function launch($action='listen')
// Find out the process by name
$psCmd = "ps aux | grep \"{$search}\" | grep -v grep";
$psInfoCmd = "ps aux | egrep \"PID|{$search}\" | grep -v grep";

if ($this->psPathFilter) {
$psCmd .= " | grep ".FCPATH;
$psInfoCmd .= " | grep ".FCPATH;
}

$exist = (shell_exec($psCmd)) ? true : false;

if ($exist) {

$psInfo = shell_exec($psInfoCmd);
die("Skip: Same process `{$action}` is running: {$route}.\n------\n{$psInfo}");
}
Expand Down