Laravel schedule:run not running properly

527 views Asked by At

So I have Kernel.php like this:

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        'App\Console\Commands\IcalConvert',
        'App\Console\Commands\NewsScrape',
        'App\Console\Commands\CinemaScrape',
        'App\Console\Commands\DownloadIcal',
        'App\Console\Commands\EventCreate',
        'App\Console\Commands\EventDelete',
        'App\Console\Commands\EventUpdate',
        'App\Console\Commands\DeleteOldEvents',
        'App\Console\Commands\ClearEvents',
        'App\Console\Commands\EventReCalculate',
        'App\Console\Commands\MondayEmail',
        'App\Console\Commands\UploadToS3'
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $ping =  config('app.ping');
        /*
        $schedule->command('scrape:news')
                 ->hourly()
                 ->weekdays()
                 ->between('7:00', '18:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        */
        $schedule->command('scrape:cinema')
                 ->dailyAt('04:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('ical:download')
                 ->hourly()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('ical:convert')
                 ->hourly()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('events:forcedelete')
                 ->dailyAt('02:00')
                 ->sendOutputTo($log)
                 ->thenPing($ping);
        $schedule->command('events:recalculate')
                ->dailyAt('2:15')
                ->sendOutputTo($log)
                ->thenPing($ping);
        $schedule->command('event:clear')
                 ->everyTenMinutes()
                 ->sendOutputTo($log)
                 ->thenPing($ping);
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

and in forge:

205984 Every Minute * * * * * forge php /home/forge/app.com/current/artisan schedule:run

What happens is that the log says command is being triggered i.e:

scheduling scrape:cinema etc,

However nothing happens. Command should be calling a job which should go to the queue, but the queue is empty!

When I manually trigger the command it works fine!

When I schedule a job in forge like this:

 205986 Every Minute * * * * * forge php /home/forge/app.com/current/artisan scrape:cinema

It also works fine.

What is going on...

0

There are 0 answers