|# Laravel queue worker using systemd|
|# run this command to enable service:|
|# systemctl enable queue.service|
|Description=Laravel queue worker|
|ExecStart=/usr/bin/php /path/to/laravel/artisan queue:work --daemon --env=production|
Otherwise it seems to be working just fine, thanks!
Also, the correct location of the file is on /etc/systemd/system/ not on /lib/systemd/system.
Those are the directories (https://wiki.archlinux.org/index.php/Systemd/User)
Thanks for posting this. I just used it on a Centos 7 cPanel server.
The only catch I had was that I had to replace the www-data with the user and group the files were registered under as cPanel executes PHP under the system user name and not www-data.
Apart from that all I had to do to get it going was run:
Also, when I made a change the service file I had to run:
All in all, it was very easy, thanks!
For me it is not working. I constantly get the following:
The command works fine if I execute it from the terminal. So I've fixed it by:
This way it is working like a charm and also restarts if I kill the process manually. systemctl restart and stop also works.
One should add:
I am going to try it.
For those looking for some basic answers about how to use systemd, Justin Ellingwood wrote some great tutorials on the Digital Ocean blog, here's one for example: https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal
These are excellent resources, def worth familiarizing yourself with systemd's high-level concepts and basic commands, especially since things like NGINX and PHP-FPM are probably running on your servers using systemd.