connection = $connection; $this->configGenerator = $configGenerator; } protected function configure() { $this ->setName('recast:daemon') ->setDescription('Run daemon which automaticly update config and reloads RTMP Server if needed'); } protected function execute(InputInterface $input, OutputInterface $output) { while(1) { if ($this->connection->fetchColumn('SELECT 1 FROM queue')) { $this->configGenerator->generate(); system($this->container->getParameter('nginxReloadCommand')); //$io = new SymfonyStyle($input, $output); //$io->success('Configs generated, rtmp has been reloaded'); $this->connection->executeQuery('TRUNCATE queue'); } sleep(3); } } }