app-admin/consul-template: use SIGINT to stop service
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Oct 2016 16:19:33 +0000 (09:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Oct 2016 16:20:34 +0000 (09:20 -0700)
Package-Manager: portage-2.3.2

app-admin/consul-template/files/consul-template.initd
app-admin/consul-template/files/consul-template.service

index 7add14f3a57365c05c4a1cd857533660942b6a2e..ab63e7fd759713770b4f18f6bef3dfbe8bba754c 100644 (file)
@@ -1,5 +1,5 @@
 #!/sbin/openrc-run
-# Copyright 2015 Gentoo Foundation
+# Copyright 2015-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -23,3 +23,10 @@ depend() {
 start_pre() {
        checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
 }
+
+stop() {
+       # SIGINT is required for graceful shutdown of consul-template
+       ebegin "Stopping ${SVCNAME}"
+       start-stop-daemon --stop --signal SIGINT --pidfile "${pidfile}"
+       eend $?
+}
index be4ac71c7288c0b0a88c1ee24b65b587deead5e8..69b1c86ddb468e9bfa55a34f56bdb3a2298022d6 100644 (file)
@@ -9,6 +9,7 @@ Environment=CONSUL_TEMPLATE_DAEMON_OPTS="-config=/etc/consul-template.d"
 ExecStart=/usr/bin/consul-template $CONSUL_TEMPLATE_DAEMON_OPTS
 Restart=on-failure
 SuccessExitStatus=12
+KillSignal=SIGINT
 ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]