Files
zhamao-framework/src/ZM/Command/Server/ServerReloadCommand.php

29 lines
709 B
PHP
Raw Normal View History

2021-11-16 15:41:01 +08:00
<?php
declare(strict_types=1);
2021-11-16 15:41:01 +08:00
namespace ZM\Command\Server;
use Swoole\Process;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use ZM\Command\Daemon\DaemonCommand;
class ServerReloadCommand extends DaemonCommand
{
protected static $defaultName = 'server:reload';
protected function configure()
{
$this->setDescription('重载框架');
2021-11-16 15:41:01 +08:00
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
2021-11-16 15:41:01 +08:00
parent::execute($input, $output);
Process::kill(intval($this->daemon_file['pid']), SIGUSR1);
$output->writeln('<info>成功重载!</info>');
2021-11-16 15:41:01 +08:00
return 0;
}
}