Skip to content

Instantly share code, notes, and snippets.

@thomasjsn
Last active April 26, 2024 09:34
Show Gist options
  • Save thomasjsn/bc7d3a3b81d0118f6e89eef7d43f66f3 to your computer and use it in GitHub Desktop.
Save thomasjsn/bc7d3a3b81d0118f6e89eef7d43f66f3 to your computer and use it in GitHub Desktop.
Laravel queue worker using systemd.
# Laravel queue worker using systemd
# ----------------------------------
#
# /lib/systemd/system/queue.service
#
# run this command to enable service:
# systemctl enable queue.service
[Unit]
Description=Laravel queue worker
[Service]
User=www-data
Group=www-data
Restart=on-failure
ExecStart=/usr/bin/php /path/to/laravel/artisan queue:work --daemon --env=production
[Install]
WantedBy=multi-user.target
@bertalanimre
Copy link

If the process is there, but no actual job is being done, that looks like privileges issue. Make sure, the process is being run by the same user who is serving the application too. Also, I just noticed, running an artisan worker as root is very much not adviced.

@tentree-development
Copy link

oh I see thank you very much and I appreciate for being patient :)

@glaszig
Copy link

glaszig commented May 18, 2023

the --daemon option is deprecated. programs under control of systemd should not daemonize anyway.

@cAstraea
Copy link

Having a bunch of issues with this ... freaking amazon removed supervisord from amazon linux 2023 and system d is the only way it seems but I'm not experience enough on how to use it. I just wish they would bring back supervisord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment