I have a question about Laravel queue. first of all My queue driver is database, if I once call the cron job with command queue:work, the queue will work forever? or i must define a cron job run every minutes?
Asked
Active
Viewed 1,082 times
1
-
check your laravel.log file, you definitely got some error in your job.. – ankit patel Nov 07 '17 at 23:00
-
@ankitpatel my question is about cron job.. i need set a cron to call queue:work every minutes? or its done with call yearly – Morteza Negahi Nov 07 '17 at 23:05
1 Answers
1
you need to set your command or queue for every minute in Console/Kernel.php file's Schedule function
Command:
$schedule->command('your-command')->everyMinute();
Job:
$schedule->job(new JOBCLASS)->everyMinute();
then you need to enter
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
in your crontab file on server which check every minute in your kernel file to check whether any command is set or not

ankit patel
- 1,888
- 11
- 12
-
What is the difference between **** php /path artisan queue:work and **** php /path sheduler:run? – Morteza Negahi Nov 07 '17 at 23:24
-
@MortezaNegahi Queues and schedulers are totally different things! read the docs! – Steph Nov 07 '17 at 23:25
-
But sheduler:run run my job and queue:work run it too ! i cant feel this diffrently, thank you for big help :-) – Morteza Negahi Nov 07 '17 at 23:28
-
You need to set scheduler to run your job.. the answer which I mentioned above will set your all job in database jobs table. and scheduler will check every minute is there any entry in jobs table or not – ankit patel Nov 07 '17 at 23:48
-