laravel queue:work freezes
//laravel //Execute Laravel queues by queue names on command line interface-> // I was using running command 'php artisan queue:work' // which was not running my queued jobs in jobs table. // Then i relaized, it was only working for jobs with queue column value = 'default' // and i had given names like sendemail, inboxemail etc. to queues while dispatching jobs (->onQueue('sendemail')) // So when i changed this other value to 'default' in queue column in jobs table, // this job ran instantly as i have opended cli and php artisan queue:work // command was active. //So if you want to run only a specific queue by queue name, run command -> php artisan queue:work --queue=sendemail // or php artisan queue:listen --queue=sendemail //here, sendemail is the name of queue i have given while using ->onQueue('sendemail') //while dispatching a job //you can google difference between queue:work and queue:listen, however queue:work is good to use //Now, if you want to automate these queues in background, so that you dont //have to get back to cli every time you want to execute these queues, use //supervisor //supervisor commands -> use these commands in php root folder, not inside laravel project sudo apt-get install supervisor or sudo yum install supervisor //then you need to make changes to installed /etc/supervisord.conf file where //you find below code starting with [program:laravel-worker] or paste below code if //it is not there [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /path to your laravel project/artisan queue:work database --tries=2 --queue=default,otherqueuename,anyotherqueuename autostart=true autorestart=true ;user=forge numprocs=1 redirect_stderr=true stdout_logfile=/path to your laravel project/worker.log //worker.log file will get updated with all the queues that supervisor executes //commands to start , stop supervisor, so you can check jobs queues in database //in jobs table if you are actually having jobs to be processed by supervisor sudo service supervisord restart sudo service supervisord stop