public function start(Job $job)
    {
        $jobData = new JobData();

        if ($this->exec) {
            $jobDir = $this->_getJobDirectory($job);
            $logFile = realpath($this->getDirectory()) . '/run.log';
            $lockFile = $this->_lockJob($jobDir);

            if ($lockFile) {
                // $jobdir = str_replace("/", DIRECTORY_SEPARATOR, $jobDir);

                $jobData->lockFile = $lockFile;
                $jobData->job = $job;
                $jobData->jobDir = $jobDir;

                $this->runningJobs[spl_object_hash($job)] = $jobData;

                $data = $job->getData();
                $data['___class'] = get_class($job);

                file_put_contents("$jobDir/in.serialize", serialize($data));

                $cmd = $this->getCmd('"'.realpath(__DIR__ . "/../../bin/AsynchronousJobsRun.php") . "\" $jobDir >> $logFile");
                if (substr(php_uname(), 0, 7) == "Windows") {
                    $WshShell = new \COM("WScript.Shell");
                    $WshShell->Run("$cmd /C dir /S %windir%", 0, false);
                } else {
                    exec($cmd . " &");
                }

            } else {
                $this->pendingJobs[] = $job;
            }
        }else {
            $job->run();
            $job->end($jobData);
        }
    }
public function start(Job $job)
    {
        $jobData = new JobData();

        if ($this->exec) {
            $jobDir = $this->_getJobDirectory($job);
            $logFile = realpath($this->getDirectory()) . '/run.log';
            $lockFile = $this->_lockJob($jobDir);

            if ($lockFile) {
                // $jobdir = str_replace("/", DIRECTORY_SEPARATOR, $jobDir);

                $jobData->lockFile = $lockFile;
                $jobData->job = $job;
                $jobData->jobDir = $jobDir;

                $this->runningJobs[spl_object_hash($job)] = $jobData;

                $data = $job->getData();
                $data['___class'] = get_class($job);

                file_put_contents("$jobDir/in.serialize", serialize($data));

                $cmd = $this->getCmd('"'.realpath(__DIR__ . "/../../bin/AsynchronousJobsRun.php") . "\" $jobDir >> $logFile");
                if (substr(php_uname(), 0, 7) == "Windows") {
                    $WshShell = new \COM("WScript.Shell");
                    $WshShell->Run("$cmd /C dir /S %windir%", 0, false);
                } else {
                    exec($cmd . " &");
                }

            } else {
                $this->pendingJobs[] = $job;
            }
        }else {
            $job->run();
            $job->end($jobData);
        }
    }
public function start ( Job $ job ) { $ jobData = new JobData ( ) ; if ( $ this -> exec ) { $ jobDir = $ this -> _getJobDirectory ( $ job ) ; $ logFile = realpath ( $ this -> getDirectory ( ) ) . '/run.log' ; $ lockFile = $ this -> _lockJob ( $ jobDir ) ; if ( $ lockFile ) { // $jobdir = str_replace("/", DIRECTORY_SEPARATOR, $jobDir); $ jobData -> lockFile = $ lockFile ; $ jobData -> job = $ job ; $ jobData -> jobDir = $ jobDir ; $ this -> runningJobs [ spl_object_hash ( $ job ) ] = $ jobData ; $ data = $ job -> getData ( ) ; $ data [ '___class' ] = get_class ( $ job ) ; file_put_contents ( "$jobDir/in.serialize" , serialize ( $ data ) ) ; $ cmd = $ this -> getCmd ( '"' . realpath ( __DIR__ . "/../../bin/AsynchronousJobsRun.php" ) . "\" $jobDir >> $logFile" ) ; if ( substr ( php_uname ( ) , 0 , 7 ) == "Windows" ) { $ WshShell = new \ COM ( "WScript.Shell" ) ; $ WshShell -> Run ( "$cmd /C dir /S %windir%" , 0 , false ) ; } else { exec ( $ cmd . " &" ) ; } } else { $ this -> pendingJobs [ ] = $ job ; } } else { $ job -> run ( ) ; $ job -> end ( $ jobData ) ; } }
Start the execution of a job.

@param Job $job
Start the execution of a job .