protected function printCommandLabel(ScheduledCommandInterface $command)
 {
     $this->table->addRow(array(is_array($command->environment()) ? implode(',', $command->environment()) : $command->environment(), $command->getName(), '', '', '', '', '', '', $command->user()));
     return true;
 }
Пример #2
0
 /**
  * Indicate why a command has run
  *
  * @param ScheduledCommandInterface $command
  * @param                           $runCommand
  */
 public function commandRun(ScheduledCommandInterface $command, $runCommand)
 {
     if ($this->optionReader->isDebugMode()) {
         $this->output->writeln('     <info>' . $command->getName() . '</info>: ' . $runCommand);
     }
 }
Пример #3
0
 /**
  * Get a command to run this application
  *
  * @param \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $scheduledCommand
  * @param array                                                    $arguments
  * @param array                                                    $options
  *
  * @return string
  */
 public function getRunCommand(ScheduledCommandInterface $scheduledCommand, array $arguments = [], array $options = [])
 {
     /** @var \Indatus\Dispatcher\Platform $platform */
     $platform = App::make('Indatus\\Dispatcher\\Platform');
     $commandPieces = [];
     if ($platform->isHHVM()) {
         $commandPieces[] = '/usr/bin/env hhvm';
     } else {
         $commandPieces[] = PHP_BINARY;
     }
     $commandPieces[] = base_path() . '/artisan';
     $commandPieces[] = $scheduledCommand->getName();
     if (count($arguments) > 0) {
         $commandPieces[] = $this->prepareArguments($arguments);
     }
     if (count($options) > 0) {
         $commandPieces[] = $this->prepareOptions($options);
     }
     //always pass environment
     $commandPieces[] = '--env=' . App::environment();
     if ($platform->isUnix()) {
         $commandPieces[] = '> /dev/null';
         //don't show output, errors can be viewed in the Laravel log
         $commandPieces[] = '&';
         //run in background
         //run the command as a different user
         if (is_string($scheduledCommand->user())) {
             array_unshift($commandPieces, 'sudo -u ' . $scheduledCommand->user());
         }
     } elseif ($platform->isWindows()) {
         $commandPieces[] = '> NULL';
         //don't show output, errors can be viewed in the Laravel log
         //run in background on windows
         array_unshift($commandPieces, '/B');
         array_unshift($commandPieces, 'START');
     }
     return implode(' ', $commandPieces);
 }
 /**
  * Get a command to run this application
  *
  * @param \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $scheduledCommand
  * @param array $arguments
  * @param array $options
  *
  * @return string
  */
 public function getRunCommand(ScheduledCommandInterface $scheduledCommand, array $arguments = array(), array $options = array())
 {
     /** @var \Indatus\Dispatcher\Platform $platform */
     $platform = App::make('Indatus\\Dispatcher\\Platform');
     //load executable path
     $executablePath = Config::get('dispatcher::executable');
     if (!is_null($executablePath)) {
         $commandPieces = array($executablePath);
     } else {
         $commandPieces = array();
         if ($platform->isUnix()) {
             $commandPieces[] = '/usr/bin/env';
         }
         if ($platform->isHHVM()) {
             $commandPieces[] = 'hhvm';
         } else {
             $commandPieces[] = 'php';
         }
     }
     $commandPieces[] = base_path() . '/artisan';
     $commandPieces[] = $scheduledCommand->getName();
     if (count($arguments) > 0) {
         $commandPieces[] = $this->prepareArguments($arguments);
     }
     if (count($options) > 0) {
         $commandPieces[] = $this->prepareOptions($options);
     }
     if ($platform->isUnix()) {
         $commandPieces[] = '> /dev/null';
         //don't show output, errors can be viewed in the Laravel log
         $commandPieces[] = '&';
         //run in background
         //run the command as a different user
         if (is_string($scheduledCommand->user())) {
             array_unshift($commandPieces, 'sudo -u ' . $scheduledCommand->user());
         }
     } elseif ($platform->isWindows()) {
         $commandPieces[] = '> NULL';
         //don't show output, errors can be viewed in the Laravel log
         //run in background on windows
         array_unshift($commandPieces, '/B');
         array_unshift($commandPieces, 'START');
     }
     return implode(' ', $commandPieces);
 }