laravel horizon

This commit is contained in:
2019-05-14 04:39:55 +00:00
parent b20bde1f56
commit 34e42d3846
464 changed files with 57914 additions and 69 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Laravel\Horizon;
use Symfony\Component\Process\Process;
class SystemProcessCounter
{
/**
* The base command to search for.
*
* @var string
*/
public static $command = 'horizon:work';
/**
* Get the number of Horizon workers for a given supervisor.
*
* @param string $name
* @return int
*/
public function get($name)
{
$process = Process::fromShellCommandline('exec ps aux | grep '.static::$command, null, ['COLUMNS' => '2000']);
$process->run();
return substr_count($process->getOutput(), 'supervisor='.$name);
}
}