为什么命令没有在cron Laravel 5.2中运行?

时间:2017-09-08 05:30:06

标签: php unix laravel-5 cron

我的队列配置 的配置/队列:

'connections' => [    
        'sync' => [
            'driver' => 'sync',
        ],    
        'database' => [
            'driver' => 'database',
            //'table'  => 'jobs',
            'table'  => 'ncste_jobs',
            'queue'  => 'default',
            'expire' => 60,
        ],  
    ],
    'failed' => [
        'database' => env('DB_CONNECTION', 'mysql'),
        'table'    => 'ncste_failed_jobs',
    ],

的Konsole / Kernel.php:

protected function schedule(Schedule $schedule)
    {
//here som comand
        $schedule->command('sudo supervisorctl stop laravel-worker:*')->name('supervisorctl-stop')->everyMinute()->withoutOverlapping();
        $schedule->command('sudo supervisorctl start laravel-worker:*')->name('supervisorctl-start')->everyMinute()->withoutOverlapping();
//here some command
}

的Cron:

* * * * * /usr/bin/php /var/www/mydomain.com/artisan schedule:run 1>>/dev/null 2>&1

为什么这两个命令不能通过cron工作?如果手动运行它。

1 个答案:

答案 0 :(得分:0)

    $schedule->exec('sudo supervisorctl stop laravel-worker:*')->everyMinute()->withoutOverlapping();
    $schedule->exec('sudo supervisorctl start laravel-worker:*')->everyMinute()->withoutOverlapping();