db = $db; } public function runPendingJobs() { foreach ($this->getConfiguredJobs() as $job) { if ($job->shouldRun()) { Logger::info('Director JobRunner is starting "%s"', $job->job_name); $this->run($job); } } } protected function run(DirectorJob $job) { if ($this->shouldFork()) { $this->fork($job); } else { $job->run(); } } protected function fork(DirectorJob $job) { $cmd = 'icingacli director job run ' . $job->id; $output = `$cmd`; // TODO: capture output } protected function shouldFork() { return true; } protected function getConfiguredJobs() { return DirectorJob::loadAll($this->db); } }