示例#1
0
     continue;
 }
 debug("Passed time checks.");
 // Check pid and do_concurrent.
 debug("Checking pid and do_concurrent.");
 if ($pid && !$row['do_concurrent']) {
     if ($row['user'] == getpiduser($pid)) {
         continue;
     }
 }
 // Begin child process.
 debug("Forking child.");
 $child = pcntl_fork();
 if ($child > 0) {
     // Update start time and pid in database.
     jobStart($cronId, $hostname, $child);
     $children[$cronId] = $child;
 } else {
     try {
         // Set working directory.
         $workdir = rtrim($row['workdir'], '/') . '/';
         if ($workdir[0] != '/') {
             $workdir = "{$cwd}{$workdir}";
         }
         // Set command.
         $command = $workdir . $row['command'];
         // Set up job.
         if ($java && $row['jenkins_job']) {
             $args = array('-Xmx1G', '-jar', exec('ls /usr/share/jenkins/external-job-monitor/java/jenkins-core-*.jar'), $row['jenkins_job'], $command);
             $command = $java;
         } else {
示例#2
0
 public static function processJobs()
 {
     $time_start = microtime(TRUE);
     $fw = \Base::instance();
     $new = "{$fw['installerCFG.db5.dbname']}`.`{$fw['installerCFG.db5.prefix']}";
     $step = $fw->get('PARAMS.step');
     $job = $fw->db5->exec("SELECT * FROM `{$new}convert` WHERE step = 0 AND success < 2 ORDER BY joborder, step ASC LIMIT 0,1");
     if ($fw->db5->count() == 0) {
         $fw->set('continue', ['message' => 'All jobs processed', 'step' => $fw->get('PARAMS.step') + 1]);
         return Template::instance()->render('steps.htm');
     } else {
         $fw->set('currently', $job[0]['job_description']);
         $path = realpath("./inc/sql/");
         $file = "job_{$job[0]['job']}.php";
         if (file_exists($path . "/upgrade_3_5_x/" . $file)) {
             require_once $path . "/upgrade_3_5_x/" . $file;
         } elseif (file_exists($path . "/install/" . $file)) {
             require_once $path . "/install/" . $file;
         } else {
             echo "Fehler!";
         }
         jobStart($job[0]);
     }
     $fw->set('time_end', microtime(TRUE) - $time_start);
     return Template::instance()->render('steps.htm');
 }