How to keep Laravel Queue system running on server

后端 未结 17 995
小鲜肉
小鲜肉 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:17

    The command

    nohup php artisan queue:work --daemon &
    

    was correct, it would allow the process to continue after closing the SSH connection; however, this is only a short term fix. Once your server is rebooted or any issue causes the process to stop you will need to go back and run the command again. When that occurs, you never know. It could happen on a Friday night, so it is better to implement a long term solution.

    I ended up switching over to Supervisord, this can be installed on Ubuntu as easy as

    sudo apt-get install supervisor 
    

    For AWS-AMI or RedHat users you can follow the set of instructions I outlined in this question:

    Setting up Supervisord on a AWS AMI Linux Server

提交回复
热议问题