setDescription('Get scheduler state'); return $this; } public function execute(InputInterface $input, OutputInterface $output) { if ( ! setup::is_installed()) { $output->writeln('Phraseanet is not set up'); return 1; } require_once __DIR__ . '/../../../../lib/bootstrap.php'; try { $appbox = appbox::get_instance(\bootstrap::getCore()); $task_manager = new task_manager($appbox); $state = $task_manager->get_scheduler_state(); if ($state['status'] == 'started') { $output->writeln(sprintf( 'Scheduler is %s on pid %d' , $state['schedstatus'] , $state['schedpid'] )); } else { $output->writeln(sprintf('Scheduler is %s', $state['status'])); } return 0; } catch (\Exception $e) { return 1; } return 0; } }