コード例 #1
0
 /**
  * Execution commands.
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (is_null(Config::$sharedId) == false && @shm_has_var(Config::$sharedId, Config::PID)) {
         $output->writeln('<info>' . Config::NAME . ' ' . shm_get_var(Config::$sharedId, Config::PID) . ' is running</info>');
         exit;
     }
     if ($input->getOption('debug') === false) {
         if (function_exists('ini_set')) {
             ini_set('error_log', Config::$path . Config::$logsPath . '/error.log');
         }
         fclose(STDIN);
         fclose(STDOUT);
         fclose(STDERR);
         $STDIN = fopen('/dev/null', 'r');
         $STDOUT = fopen(Config::$path . Config::$logsPath . '/appilication.log', 'ab');
         $STDERR = fopen(Config::$path . Config::$logsPath . '/error.log', 'ab');
     }
     $phpcron = new PHPCron(Entries::getCrontab());
     $phpcron->execute();
 }