Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shichi-at-nttr/e9552602e93ddd15d800c6bf5d3887b2 to your computer and use it in GitHub Desktop.
Save shichi-at-nttr/e9552602e93ddd15d800c6bf5d3887b2 to your computer and use it in GitHub Desktop.
Ubuntu 18.04 LTS での Consul起動用 consul.service

consul.serviceファイルの ExecPre= 行を変更する。

この行を

ExecStartPre=[ -f "/run/consul/consul.pid" ] && /usr/bin/rm -f /run/consul/consul.pid

こう変更する。

ExecStartPre=/bin/echo "[ -f /run/consul/consul.pid ] && /bin/rm -f /run/consul/consul.pid" | /bin/sh -s
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
User=consul
Group=consul
PIDFile=/run/consul/consul.pid
Restart=on-failure
Environment=GOMAXPROCS=2
ExecStartPre=/bin/echo "[ -f /run/consul/consul.pid ] && /bin/rm -f /run/consul/consul.pid" | /bin/sh -s
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