45 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Library for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://library.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
namespace library\command\task;
use library\command\Task;
/**
* Class Reset
* @package library\command\task
*/
class Reset extends Task
{
protected function configure()
{
$this->setName('xtask:reset')->setDescription('reset message queue daemon');
}
protected function execute(\think\console\Input $input, \think\console\Output $output)
{
if (($pid = $this->checkProcess()) > 0) {
$this->closeProcess($pid);
$output->info("message queue daemon {$pid} closed successfully!");
}
$this->createProcess();
if ($pid = $this->checkProcess()) {
$output->info("message queue daemon {$pid} created successfully!");
} else {
$output->error('message queue daemon creation failed, try again later!');
}
}
}