Monday, March 6, 2017

Cron job not running Laravel 5.3

So I have set up my kernel file to schedule a command to run at 2am every day.

class Kernel extends ConsoleKernel
{
/**
 * The Artisan commands provided by your application.
 *
 * @var array
 */
protected $commands = [
    Commands\Users\MyCommand::class
];

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command(Commands\Users\MyCommand::class)
        ->dailyAt('02:00');
}
}

I have also run this in command line as suggested by the docs:

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

when I run 'php artisan MY COMMAND NAME' in command line the command executes. Also, when I use schedule:run at the correct time the command also runs.

However, I would like it to run automatically at the specified time and this is not happening.



via DanielPahor

Advertisement