Reputation: 585
I have those 3 commands to run in schedule.
$schedule->command("update:branchsales")->everyFiveMinutes()->timezone('America/Sao_Paulo')->withoutOverlapping();
$schedule->command("update:billing")->everyFiveMinutes()->timezone('America/Sao_Paulo')->withoutOverlapping();
$schedule->command("update:sales")->everyFiveMinutes()->timezone('America/Sao_Paulo')->withoutOverlapping();
But in log, we can see only 2 of them are actually running.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:sales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:sales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
No scheduled commands are ready to run.
I can run that update:billing
manually but it suddenly stopped to run in schedule.
All of them were running till yesterday.
Any help will be appreciated.
Edit:
update:sales
also stopped now.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:sales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:sales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
No scheduled commands are ready to run.
No scheduled commands are ready to run.
No scheduled commands are ready to run.
No scheduled commands are ready to run.
Running scheduled command: '/usr/local/bin/php' 'artisan' update:branchsales > '/dev/null' 2>&1
Upvotes: 4
Views: 1728
Reputation: 397
In my case, the issue was with the incorrect project path specified in the crontab configuration.
To fix this,
Open the crontab configuration for editing:
crontab -e
Add the following line to schedule Laravel tasks:
* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1
Upvotes: 0
Reputation: 585
I found a answer to that problem here. Hope it helps someone.
Just executed php artisan cache:clear
on the project folder and all seems to be working now.
Upvotes: 0
Reputation: 175
I was having almost same issue few days back after some research I reached to the following solution,
protected function osProcessIsRunning($needle)
{
// get process status. the "-ww"-option is important to get the full output!
exec('ps aux -ww', $process_status);
// search $needle in process status
$result = array_filter($process_status, function($var) use ($needle) {
return strpos($var, $needle);
});
// if the result is not empty, the needle exists in running processes
if (!empty($result)) {
return true;
}
return false;
}
protected function schedule(Schedule $schedule)
{
if (!$this->osProcessIsRunning('update:sales')) {
$schedule->command("update:branchsales")->everyFiveMinutes()->timezone('America/Sao_Paulo')->withoutOverlapping();
}
//Similarly do for other two commands
}
Now only run your schedule command in cron job like schedule:run it will also prevent extra load on the server, I have found this answer on Laracast forget link else I would have shared!
Upvotes: 1
Reputation: 784
Check running processes, maybe the command is working (stuck) and do not run because of withoutOverlapping
.
ps aux | grep 'php artisan'
Upvotes: 1