diff --git a/src/Console/SupervisorStatusCommand.php b/src/Console/SupervisorStatusCommand.php new file mode 100644 index 00000000..48909e84 --- /dev/null +++ b/src/Console/SupervisorStatusCommand.php @@ -0,0 +1,52 @@ +argument('name'); + + $supervisorStatus = optional(collect($supervisors->all())->first(function ($supervisor) use ($name) { + return Str::startsWith($supervisor->name, MasterSupervisor::basename()) && + Str::endsWith($supervisor->name, $name); + }))->status; + + if (is_null($supervisorStatus)) { + $this->components->error('Unable to find a supervisor with this name.'); + + return 1; + } + + $this->components->info("{$name} is {$supervisorStatus}"); + } +} diff --git a/src/HorizonServiceProvider.php b/src/HorizonServiceProvider.php index 3f00a45e..2bb89730 100644 --- a/src/HorizonServiceProvider.php +++ b/src/HorizonServiceProvider.php @@ -115,6 +115,7 @@ protected function registerCommands() Console\PurgeCommand::class, Console\StatusCommand::class, Console\SupervisorCommand::class, + Console\SupervisorStatusCommand::class, Console\SupervisorsCommand::class, Console\TerminateCommand::class, Console\TimeoutCommand::class,