Skip to content

Commit

Permalink
fixed runtime status
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed Aug 28, 2018
1 parent 49db592 commit 39b1b4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,16 @@ function process_is_running($keyword)
return empty($output) ? false : true;
}

/**
* @param $port
* @return bool
*/
function port_is_running($port)
{
$command = "lsof -i:{$port} | grep LISTEN";

exec($command, $output);

return !empty($output);
}

3 changes: 2 additions & 1 deletion src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ public function isRunning()
if (file_exists($this->config['pid_file'])) {
return posix_kill(file_get_contents($this->config['pid_file']), 0);
}
return process_is_running("{$this->name} master");

return process_is_running("{$this->name} master") && port_is_running($this->port);
}

/**
Expand Down

0 comments on commit 39b1b4d

Please sign in to comment.