S
S
sawa42017-09-08 08:01:29
Task Schedulers
sawa4, 2017-09-08 08:01:29

Why is the command not executing in laravel 5.2 cron?

Hello everyone, straight to the point
config/queue config:

'connections' => [

        'sync' => [
            'driver' => 'sync',
        ],

        'database' => [
            'driver' => 'database',
            //'table'  => 'jobs',
            'table'  => 'ncste_jobs',
            'queue'  => 'default',
            'expire' => 60,
        ],

        'beanstalkd' => [
            'driver' => 'beanstalkd',
            'host'   => 'localhost',
            'queue'  => 'default',
            'ttr'    => 60,
        ],

        'sqs' => [
            'driver' => 'sqs',
            'key'    => 'your-public-key',
            'secret' => 'your-secret-key',
            'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
            'queue'  => 'your-queue-name',
            'region' => 'us-east-1',
        ],

        'redis' => [
            'driver'     => 'redis',
            'connection' => 'default',
            '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 these 2 commands do not work through cron? There are a couple more commands in the same file, they work. If run manually it works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
VALIKHANK, 2017-09-08
@sawa4

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

R
Roman Frank, 2017-09-08
@Akellacom

Maybe you don't have permissions? Have you tried looking at /var/log/cron logs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question