/** * Launch a job from the job queue * @param Schedule_Maintenance_Job $job */ protected function launchJob($job) { $pid = pcntl_fork(); if ($pid == -1) { //Problem launching the job Logger::error('Could not launch new job with id [ ' . $job->getId() . ' ], exiting'); return false; } else { if ($pid) { $this->currentJobs[$pid] = $job->getId(); if (isset($this->signalQueue[$pid])) { $this->childSignalHandler(SIGCHLD, $pid, $this->signalQueue[$pid]); unset($this->signalQueue[$pid]); } } else { //Forked child try { Logger::debug("Executing job [ " . $job->getId() . " ] as forked child"); Pimcore_Resource::reset(); $job->execute(); } catch (Exception $e) { Logger::error($e); Logger::error("Failed to execute job with id [ " . $job->getId() . " ] and method [ " . $job->getMethod() . " ]"); } $job->unlock(); Logger::debug("Done with job [ " . $job->getId() . " ]"); exit(0); } } return true; }