доработки в рамках трейдингового бота и поднятие версии до 1.4.0
This commit is contained in:
1 parent
41a0c8878c
commit
f3bfef9788
30 files changed
+2082
-69
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rsgrinko\Proton\Console\Commands;
|
||||
|
||||
use Rsgrinko\Proton\Console\Command;
|
||||
use Rsgrinko\Proton\Console\DaemonCommand;
|
||||
|
||||
/**
|
||||
* попросить демон (DaemonCommand) выйти.
|
||||
*/
|
||||
final class DaemonStopCommand extends Command
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
return 'daemon:stop';
|
||||
}
|
||||
|
||||
public function usage(): string
|
||||
{
|
||||
return 'daemon:stop <имя команды>';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'демон доработает круг и выйдет (служба поднимет его заново)';
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
$name = $this->arg(0);
|
||||
|
||||
if ($name === '') {
|
||||
$this->fail('Укажите имя команды-демона: ' . $this->usage());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Флаг, а не сигнал: на Windows фоновому процессу сигнал не послать,
|
||||
// а одинаковый способ на обеих системах проще помнить
|
||||
DaemonCommand::requestStop($name);
|
||||
|
||||
$this->ok('Запрос отправлен. Демон ' . $name . ' выйдет после текущего круга');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user