-
-
Save samveen/b747168897d9fc3f7c4309f0041c0fc4 to your computer and use it in GitHub Desktop.
Laravel queue worker unit template for systemd.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Laravel systemd queue worker unit template | |
# ---------------------------------- | |
# | |
# /etc/systemd/system/laravel-queue@.service | |
# Config at /etc/laravel-queue-${INSTANCE}.conf | |
# | |
# To enable an instance of this service: | |
# - Create a conf file /etc/-laravel-queue-SOME_NAME.conf which contains: | |
# - LARAVEL_USER= (required) | |
# - LARAVEL_GROUP= (required) | |
# - LARAVEL_ROOT= (required) | |
# - LARAVEL_EXTRA_PARAMS= (optional) | |
# - Enabe the unit instance: | |
# - systemctl enable laravel-queue@SOME_NAME.service | |
# WARNING: | |
# This is for systemd-219 (Centos 7) which does NOT | |
# support following directives: | |
# - WorkingDirectory - v228 - nice to have, but php changes CWD to dir of first parameter anyway | |
# - StandardOutput - v240 - not needed - use journalctl -u | |
# - StandardOutput - v240 - not needed - use journalctl -u | |
[Unit] | |
Description=Laravel queue worker | |
# enforce start before httpd | |
Before=httpd.service | |
RequiredBy=httpd.service | |
[Service] | |
EnvironmentFile="%E/laravel-queue-%i.conf" | |
User=${LARAVEL_USER} | |
Group=${LARAVEL_GROUP} | |
Restart=always | |
ExecStart=/usr/bin/php ${LARAVEL_ROOT} queue:work --daemon --env=production ${LARAVEL_EXTRA_PARAMS} | |
[Install] | |
WantedBy=multi-user.target | |
WantedBy=httpd.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment