简体   繁体   中英

Why is a command not running in cron Laravel 5.2?

My config for queue config/queue:

'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

Why do these 2 commands don't work through the cron? If run manually it work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM