1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\admin\queue\task;
- use library\command\Task;
- use think\console\Input;
- use think\console\Output;
- class Stop extends Task
- {
-
- protected function configure()
- {
- $this->setName('xtask:stop')->setDescription('[控制]平滑停止所有的异步任务进程');
- }
-
- protected function execute(Input $input, Output $output)
- {
- $this->cmd = "{$this->bin} xtask:";
- if (count($processList = $this->queryProcess()) < 1) {
- $output->writeln("没有需要结束的任务进程哦!");
- } else foreach ($processList as $item) {
- $this->closeProcess($item['pid']);
- $output->writeln("发送结束任务进程{$item['pid']}指令成功!");
- }
- }
- }
|