How to keep Laravel Queue system running on server

后端 未结 17 997
小鲜肉
小鲜肉 2020-11-28 02:23

I recently setup a Laravel Queue system. The basics are a cronjob calls a command which adds jobs to a queue and calls a second command which sends an email.

The sy

17条回答
  •  攒了一身酷
    2020-11-28 03:09

    Using pm2

    I had JS script running with pm2 (Advanced, production process manager for Node.js) Which was the only one I was running. But now as I got one more process to keep running.

    I created process.yml to run both with a single command. Check the first one would run php artisan queue: listen

    # process.yml at /var/www/ which is root dir of the project
    apps:
      # Run php artisan queue:listen to execute queue job
      - script    : 'artisan'
        name      : 'artisan-queue-listen'
        cwd       : '/var/www/'
        args      : 'queue:listen' # or queue:work
        interpreter : 'php'
    
      # same way add any other script if any.
    

    Now run:

    > sudo pm2 start process.yml
    

    Check more options and feature of pm2

提交回复
热议问题