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);
    }
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);
    }
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
Get a command to run this application