-
-
Save Manc/a5f444a8eb89dfbcf530 to your computer and use it in GitHub Desktop.
/etc/systemd/system/consul.service
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
[Unit] | |
Description=Consul service discovery agent | |
Requires=network-online.target | |
After=network.target | |
[Service] | |
User=consul | |
Group=consul | |
PIDFile=/run/consul/consul.pid | |
Restart=on-failure | |
Environment=GOMAXPROCS=2 | |
ExecStartPre=[ -f "/run/consul/consul.pid" ] && /usr/bin/rm -f /run/consul/consul.pid | |
ExecStartPre=/usr/local/bin/consul configtest -config-dir=/etc/consul.d | |
ExecStart=/usr/local/bin/consul agent $OPTIONS -pid-file=/run/consul/consul.pid -config-dir=/etc/consul.d | |
ExecReload=/bin/kill -s HUP $MAINPID | |
KillSignal=SIGINT | |
TimeoutStopSec=5 | |
[Install] | |
WantedBy=multi-user.target |
On my system /usr/bin/rm
doesn't exist and command to test config seems to be consul validate <path>
GOMAXPROCS=2 hasn't been needed for 2 years: hashicorp/consul#1679
Updated version that works on debian 9 with validate and without gomaxprocs
[Unit]
Description=Consul service discovery agent
Requires=network-online.target
After=network.target
[Service]
User=consul
Group=consul
PIDFile=/run/consul/consul.pid
Restart=on-failure
ExecStartPre=[ -f "/run/consul/consul.pid" ] && /bin/rm -f /run/consul/consul.pid
ExecStartPre=/usr/local/bin/consul validate /etc/consul.d
ExecStart=/usr/local/bin/consul agent $OPTIONS -pid-file=/run/consul/consul.pid -config-dir=/etc/consul.d
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGINT
TimeoutStopSec=5
[Install]
WantedBy=multi-user.target
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. A great systemd service file