2021-11-16 15:41:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
2022-03-15 18:05:33 +08:00
|
|
|
declare(strict_types=1);
|
2021-11-16 15:41:01 +08:00
|
|
|
|
|
|
|
|
namespace ZM\Command\Server;
|
|
|
|
|
|
|
|
|
|
use Swoole\Process;
|
2022-12-17 21:53:08 +08:00
|
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
2021-11-16 15:41:01 +08:00
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
2022-12-17 21:53:08 +08:00
|
|
|
#[AsCommand(name: 'server:reload', description: '重载服务器')]
|
2022-05-14 23:40:22 +08:00
|
|
|
class ServerReloadCommand extends ServerCommand
|
2021-11-16 15:41:01 +08:00
|
|
|
{
|
2022-03-15 18:05:33 +08:00
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
|
|
|
{
|
2021-11-16 15:41:01 +08:00
|
|
|
parent::execute($input, $output);
|
2022-03-15 18:05:33 +08:00
|
|
|
Process::kill(intval($this->daemon_file['pid']), SIGUSR1);
|
|
|
|
|
$output->writeln('<info>成功重载!</info>');
|
2021-11-16 15:41:01 +08:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|