/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { GlobalConfig::preFlight($consoleOutput); $command = $this->executable() . ' ' . GlobalConfig::getConfigFile(); $process = new Process($command, realpath(__DIR__ . '/../'), array_merge($_SERVER, $_ENV), null, null); $process->run(function ($type, $line) use($consoleOutput) { $consoleOutput->write($line); }); }
/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @throws PathNotFoundException * @throws \Exception * @throws \kriskbx\wyn\Exceptions\PropertyNotSetException * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { parent::execute($consoleInput, $consoleOutput); GlobalConfig::preFlight($consoleOutput); $this->sleep = $consoleInput->getOption('interval'); $this->workerCommand = $this->buildWorkerCommand(); $process = $this->makeProcess(); $consoleOutput->writeln('<info>Daemon started...</info>'); while (true) { $consoleOutput->writeln('<info>Running backup:cron...</info>'); $process->run(function ($type, $line) { $this->output->writeln($line); }); sleep($this->sleep); } }