protected function execute(InputInterface $input, OutputInterface $output) { $output->write("Stopping Phorever..."); $daemon = new Daemon($this->config['pidfile'], $this->getLogger()); $daemon->stop(); $output->writeln(" <info>OK!</info>"); }
protected function execute(InputInterface $input, OutputInterface $output) { $daemon = new Daemon($this->config['pidfile'], $this->getLogger()); switch ($daemon->status()) { case Daemon::RUNNING_OK: $output->writeln("<info>Phorever is running.</info>"); break; case Daemon::STOPPED_BUT_PID_PRESENT: $output->writeln("<error>Phorever is NOT running, but PID file is present!</error>"); break; case Daemon::STOPPED_OK: $output->writeln("Phorever is stopped."); break; } }
protected function execute(InputInterface $input, OutputInterface $output) { $phorever = new Phorever($this->config, $this->getLogger()); if ($input->getOption('daemon')) { $daemon = new Daemon($this->config['pidfile'], $this->getLogger()); $output->write("Starting Phorever... "); $daemon->start(function () use($phorever, $input) { $phorever->run(array('role' => $input->getArgument('role'))); }); $output->writeln("<info>OK!</info>"); } else { if ($input->getOption('force-pidfile')) { if (file_exists($this->config['pidfile'])) { throw new \Exception("PID File {$this->config['pidfile']} already exists!"); } $this->logger->debug("Writing PID File"); file_put_contents($this->config['pidfile'], getmypid()); } $phorever->run(array('role' => $input->getArgument('role'))); } }