private function createBatchwatchCmd($cmd) { // use this with no prefix $batch_name = self::getBatchNameFromCommandLine($this->batch_name); $path = myContentStorage::getFSContentRootPath() . "/batchwatch/{$batch_name}"; self::executeRunBatch($cmd, $batch_name); if ($cmd == "stop") { $path = batchStatus::batchEnd($batch_name); } return $path; }
// skip if the special file holding the registered batchs if ($batch_name[0] == "_") { continue; } //myBatchBase::IGNORE_PREFIX ) continue; if (in_array($batch_name, $batchwatch_job_list)) { $command = file_get_contents($file); // TODO - change to fit the way we start / stop / restart // $cmd_line = "service $batch_name $command"; $cmd_line = "{$PHP_CMD} runBatch.php {$command} {$batch_name} "; TRACE("{$cmd_line}"); $output = array(); exec($cmd_line, $output, $return_var); TRACE("Result: [{$return_var}]\n" . print_r($output, true)); if ($command == "stop") { $path = batchStatus::batchEnd($batch_name); } } else { TRACE("VERY BAD!!: tying to manipulate invalid batch [{$batch_name}]. Ignoring..."); } // remove the file unlink($file); } if ($count > $write_to_the_log_seconds) { $count = 0; } if ($count == 0) { TRACE("Sleeping for [{$sleep_time}] second. Will write to the log in ({$write_to_the_log_seconds}]"); } sleep($sleep_time); $count++;