Search code examples
linuxlaravelcentos6task-queuebeanstalkd

Beanstalkd to start when the system starts up or reboots , how to uncomment "START yes" on Centos


I'm using Beanstalkd for queue in Laravel on Centos 6 and I have seen that I need to uncomment the following START=yes for Beanstalkd to start when the system starts up or reboots

When I run this command nano /etc/default/beanstalkd from root directory , I can't find the file. or let me if there is another way to enable that .


Solution

  • For php to listen all times, You need to have Supervisord installed then do the following

    • Locate this file supervisord.conf by running this command: find / -name supervisord.conf
    • You get the path like this /etc/supervisord.conf
    • Edit the file sudo nano /etc/supervisord.conf
    • Make autostart=true and autorestart=true
    • At bottom, have something like this

      [program:laravel-queue-listener] command=php

      /var/www/YourProjectNameHere/artisan queue:listen --env=prod --timeout=0

    • Then restart supervisord: sudo service supervisord restart

    • Restart beanstalkd too: sudo service beanstalkd restart

    All Queues will be listened automatically without having to run php artisan queue:listen --timeout=0 manually