public function runNowAction()
    {
        $code = $this->getArg('code');
        if (empty($code)) {
            echo "\nNo code found!\n\n";
            echo $this->usageHelp();
            exit(1);
        }

        $allowedCodes = Mage::getSingleton('aoe_scheduler/job')->getResource()->getJobCodes();
        if (!in_array($code, $allowedCodes)) {
            echo "\nNo valid job found!\n\n";
            echo $this->usageHelp();
            exit(1);
        }

        $forceRun = ($this->getArg('force'));
        $tryLock = ($this->getArg('tryLock'));

        $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
        $schedule->setJobCode($code);
        $schedule->setScheduledReason(Aoe_Scheduler_Model_Schedule::REASON_RUNNOW_CLI);
        $schedule->runNow($tryLock, $forceRun);
        if ($schedule->getJobWasLocked()) {
            echo "\nJob was not executed because it was locked!\n\n";
            exit(1);
        }
        $schedule->save();

        echo "\nStatus: " . $schedule->getStatus() . "\n";
        echo "Messages:\n" . trim($schedule->getMessages(), "\n") . "\n";
    }
public function runNowAction()
    {
        $code = $this->getArg('code');
        if (empty($code)) {
            echo "\nNo code found!\n\n";
            echo $this->usageHelp();
            exit(1);
        }

        $allowedCodes = Mage::getSingleton('aoe_scheduler/job')->getResource()->getJobCodes();
        if (!in_array($code, $allowedCodes)) {
            echo "\nNo valid job found!\n\n";
            echo $this->usageHelp();
            exit(1);
        }

        $forceRun = ($this->getArg('force'));
        $tryLock = ($this->getArg('tryLock'));

        $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
        $schedule->setJobCode($code);
        $schedule->setScheduledReason(Aoe_Scheduler_Model_Schedule::REASON_RUNNOW_CLI);
        $schedule->runNow($tryLock, $forceRun);
        if ($schedule->getJobWasLocked()) {
            echo "\nJob was not executed because it was locked!\n\n";
            exit(1);
        }
        $schedule->save();

        echo "\nStatus: " . $schedule->getStatus() . "\n";
        echo "Messages:\n" . trim($schedule->getMessages(), "\n") . "\n";
    }
public function runNowAction ( ) { $ code = $ this -> getArg ( 'code' ) ; if ( empty ( $ code ) ) { echo "\nNo code found!\n\n" ; echo $ this -> usageHelp ( ) ; exit ( 1 ) ; } $ allowedCodes = Mage :: getSingleton ( 'aoe_scheduler/job' ) -> getResource ( ) -> getJobCodes ( ) ; if ( ! in_array ( $ code , $ allowedCodes ) ) { echo "\nNo valid job found!\n\n" ; echo $ this -> usageHelp ( ) ; exit ( 1 ) ; } $ forceRun = ( $ this -> getArg ( 'force' ) ) ; $ tryLock = ( $ this -> getArg ( 'tryLock' ) ) ; $ schedule = Mage :: getModel ( 'cron/schedule' ) ; /* @var $schedule Aoe_Scheduler_Model_Schedule */ $ schedule -> setJobCode ( $ code ) ; $ schedule -> setScheduledReason ( Aoe_Scheduler_Model_Schedule :: REASON_RUNNOW_CLI ) ; $ schedule -> runNow ( $ tryLock , $ forceRun ) ; if ( $ schedule -> getJobWasLocked ( ) ) { echo "\nJob was not executed because it was locked!\n\n" ; exit ( 1 ) ; } $ schedule -> save ( ) ; echo "\nStatus: " . $ schedule -> getStatus ( ) . "\n" ; echo "Messages:\n" . trim ( $ schedule -> getMessages ( ) , "\n" ) . "\n" ; }
Run a job now

@return void
Run a job now