【问题标题】:Why is a command not running in cron Laravel 5.2?为什么命令没有在 cron Laravel 5.2 中运行?
【发布时间】:2018-02-16 22:53:08
【问题描述】:

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

'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 工作?如果手动运行,它可以工作。

【问题讨论】:

    标签: php unix laravel-5 cron


    【解决方案1】:
        $schedule->exec('sudo supervisorctl stop laravel-worker:*')->everyMinute()->withoutOverlapping();
        $schedule->exec('sudo supervisorctl start laravel-worker:*')->everyMinute()->withoutOverlapping();
    

    【讨论】:

      猜你喜欢
      • 2017-02-04
      • 2016-07-03
      • 2020-11-06
      • 2010-10-21
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      • 1970-01-01
      相关资源
      最近更新 更多