mercredi 21 septembre 2016

Laravel 5.1 kernel running correctly, but scheduler not

My software is hosted on a dedicated server and has been running great for the past 2 months since I launched it. Today I woke up and realized the kernel never ran the console commands. The cron job command set on my server is:

php myApp/artisan schedule:run >> /dev/null 2>&1

I have tested a few things and realized the cron job is executing the schedule() function in app/Console/Kernel.php, however, it is not running any of the scheduled commands. Furthermore, within the schedule() function, I did:

protected function schedule(Schedule $schedule) 
{
   // send an email to myself saying "SCHEDULER STARTED"

   $schedule->call(function () {
      // send an email to myself saying "IN CALL FUNCTION"
   })->everyMinute();
}

I get the emails saying "SCHEDULER STARTED" every 1 minute, but I do not get any emails saying "IN CALL FUNCTION". I do not believe I have changed anything that would effect this. I also think it's worth mentioning that when I SSH into the server and run "php artisan some-console-command", it will run "some-console-command" successfully. If you need me to give any more info please let me know.

Unrelated, but as a temporary fix to run my console commands, for each console command I have put the code from the commands handle() function into the Kernels schedule() function (now my code is sloppy and I can't stand unorganized code D:).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire