Example #1
0
 protected function afterAction($action, $params, $exitCode = 0)
 {
     if (isset($this->service['name'])) {
         $this->log("SERVICE: Service {$this->service['name']} exited with code {$exitCode} [PID: {$this->pid}] ");
         ServiceManager::markAsStopped($this->service['name'], $this->id);
     }
     return parent::afterAction($action, $params, $exitCode);
 }
 public function afterAction($action, $params, $exitCode = 0)
 {
     if ($this->outputLog) {
         echo implode("\n", $this->_log) . "\n";
     }
     array_unshift($this->_log, 'Launched at: ' . date("Y-m-d H:i:s"));
     file_put_contents(Yii::app()->params['logDirPath'] . '/moveFollowUpAppointment.log', implode("\n", $this->_log), FILE_APPEND);
     return parent::afterAction($action, $params, $exitCode);
 }
 /**
  * (non-PHPdoc)
  * @see CConsoleCommand::afterAction()
  */
 protected function afterAction($action, $params, $exitCode = 0)
 {
     $dirPath = Yii::app()->runtimePath . '/locks/';
     $commandName = $this->getName();
     $lockFileName = "{$commandName}_{$action}_.lock";
     $lockFilePath = $dirPath . $lockFileName;
     if (file_exists($lockFilePath)) {
         unlink($lockFilePath);
     }
     return parent::afterAction($action, $params, $exitCode);
 }
 protected function afterAction($action, $params, $exitCode = 0)
 {
     \Yii::log("Unlock after action", \CLogger::LEVEL_TRACE, self::CATEGORY);
     unlink($this->lockFile);
     return parent::afterAction($action, $params, $exitCode);
 }
 public function afterAction($action, $params, $exitCode = 0)
 {
     Console::writeLine('Command ended');
     return parent::afterAction($action, $params, $exitCode);
 }
 protected function afterAction($action, $params, $exitCode = 0)
 {
     $this->isDone = true;
     return parent::afterAction($action, $params, $exitCode);
 }
Example #7
0
 /**
  * Log the command was run into cron log table and email to DEV_EMAILS cron log result
  *
  * @param string $action
  * @param array  $params
  * @param int    $exitCode
  *
  * @return int|void
  */
 public function afterAction($action, $params, $exitCode = 0)
 {
     parent::afterAction($action, $params, $exitCode = 0);
     $commandName = $_SERVER['argv'][1];
     $params = json_encode($params);
     $serverName = gethostname();
     $model = new CronLog();
     $model->command_name = $commandName;
     $model->params = $params;
     $model->server_name = $serverName;
     $logFile = $this->getLogFile();
     $model->run_log = @file_get_contents($logFile);
     if ($this->emailLog) {
         $logs = "{$commandName} is run at " . date('m/d/Y h:i:s') . "\n";
         $logs .= 'Parameters: ' . print_r($_SERVER['argv'], 1) . "\n";
         $logs .= $this->getLogs();
         $logs .= print_r($_SERVER, 1);
         xmail($commandName . ' run log', nl2br($logs), SETTINGS_DEV_EMAILS);
     }
     @unlink($logFile);
     $model->save();
 }