Laravel cron job issue with withoutOverlapping() – A Weblog of Priyank Maniar https://priyank.rocks Articles on web development & mobile app development Sat, 25 Jul 2020 02:38:36 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 Issues with Laravel cron job not working (scheduler) https://priyank.rocks/issues-with-laravel-cron-job-scheduler/ Fri, 18 Jan 2019 06:28:59 +0000 http://priyank.rocks/?p=315 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.

]]>