Laravel docs:
- cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
This Cron will call the Laravel command scheduler every minute. When the schedule:run command is executed, Laravel will evaluate your scheduled tasks and runs the tasks that are due.
I run these codes below in app\Console\Kernel.php
:
$schedule->job(new \App\Jobs\done)->everyMinute();
$schedule->command('done:done')->everyMinute();
but none of them worked! so I run the command php artisan schedule:run
but it runs only once and each time I want to make it trigger the job/command I should run that command so I tried to use the command above in Laravel docs. However again it didn't work every minute. So I tried to create a task in Task Scheduler
and run it every 5 minutes(because it didn't have less than 5) now it's working but the usage of ->everyMinute()
is redundant because the schedule of Laravel only runs but the main job that is done is by Windows Task Scheduler. So how can I fix it in order not to use cron job nor windows task scheduler?
Thanks
Just so you can close the question.
As I said in the comments / chat
php artisan done:done
in your Windows Task Schedule and not use the Laravel Kernel at all.everyMinute()
is ignored when you run the job manually is because Laravel know that a cron can't be executed more than once a minute. So it doesn't keep a trace for a job set to everyMinute()
. This mean, every time you run the command php artisan schedule:run
it will run the job.And has @kyslik mentioned in the chat : The scheduler is well covered in the official documentation: https://laravel.com/docs/5.7/scheduling#introduction