Skip to main content
Laravel

Issues with Laravel cron job not working (scheduler)

By January 18, 2019July 25th, 2020No Comments

I noticed some of the cron jobs were not running. You can use the following command to check and run the cron job execution.

1
php artisan schedule:run

Laravel is great at almost everything but there are few areas where it lacks its awesomeness.

Problem with cron job (Laravel – 5.2)

Turns out when the cron has withoutOverlapping method chained. It creates a file in the storage/framework folder with the name of schedule-***.

It appears the existence of this file is used to check whether the cron job is running or not. When the cron job fails for whatever reason the file is not deleted. Since the file exists the system thinks the cron job is still running and it is not done yet.

This prevents the cron job execution.

For now the solution is to delete the schedule-*** file.

PLEASE NOTE: I would also want to add one of my observations: php artisan schedule:run will not show the task(s), if the job only runs on a specific day (e.g. everyFriday()) and specific time. The tasks with everyMinute() should run just fine. It makes sense too.