Skip to content

Instantly share code, notes, and snippets.

@yunano
Created May 1, 2015 15:54
Show Gist options
  • Save yunano/7178c825bd4450f03f4a to your computer and use it in GitHub Desktop.
Save yunano/7178c825bd4450f03f4a to your computer and use it in GitHub Desktop.
/etc/systemd/system/consul-template.service
[Unit]
Description=consul-template
Requires=network-online.target
After=network-online.target consul.service vault.service
[Service]
EnvironmentFile=-/etc/sysconfig/consul-template
Restart=on-failure
ExecStart=/usr/local/sbin/consul-template $OPTIONS -config=/etc/consul-template.d
[Install]
WantedBy=multi-user.target
@sepulworld
Copy link

Newer versions of consul-template no longer pass all signals to child processes. SIGINT is passed through though.
adding the following to this systemd will allow for working restarts and stops via systemd

KillSignal=SIGINT

@charandas
Copy link

For anyone, who ends up here, KillSignal=SIGINT goes under [Service] section. It can be tested with kill -2 while you watch the service on another tab with journalctl -u consul-template -f.

@jlj77
Copy link

jlj77 commented Nov 25, 2020

For anyone, who ends up here, KillSignal=SIGINT goes under [Service] section. It can be tested with kill -2 while you watch the service on another tab with journalctl -u consul-template -f.

Thanks for this.

Also note that requiring a local vault.service limits its utility: I'm about to run this service on the nodes of my Consul cluster -- to rotate the gossip key -- which is supporting a Vault service elsewhere.

[Edit: my mistake; read it too quickly: After is a loose coupling.]

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