Hello, I have configured a cron job with plesk in my droplet to run a laravel command every minute
/opt/plesk/php/7.1/bin/php /var/www/vhosts/website/laravel/artisan schedule:run
This executes the Laravel scheduler, that is filled with tasks to run at certain time, lets say send emails at 10:00
and send SMS at 11:00
So when the cron runs the scheduler and a task is found at the same time it executes the task, eg 9.58 no tasks 9.59 no tasks 10:00 send emails 10:01 no tasks
My problem is that FOR SOME STRANGE REASON the scheduler is delayed at some times, so the problem is like this 9.58 no tasks 9.59 no tasks 10:01 no tasks 10:01 no tasks
If I run this command from command line, it runs instantly, with no delay. But for some reason when this is executed from the cron, sometimes is delayed. I have tested the cron from inside plesk, there is a button Run now
and is true, for some reason sometimes it takes about 65 seconds to run the cron job or the command artisan schedule:run
Any ideas? This only happens in the droplet I have, not in local environment.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
The issue was caused by depleted entropy by PHP script.
To resolve the issue generate entropy by using haveged daemon:
Enable EPEL repository:
yum install epel-release
Install daemon with the following command and enable it:
Hi @unixynet, I have disabled the Laravel scheduler cron and create a simple cron with a php file that records time of execution, and the problem seems to still be there… I’m thinking this is more of a server issue than a laravel. See results:
Cron logs
PHP file execution logs
Cron looks OK. How’s your DB? Can you enable the slow log to see if any queries are slowing things down and thus affecting event clearing?