consul-template.initd 841 B

1234567891011121314151617181920212223242526272829303132
  1. #!/sbin/openrc-run
  2. # Copyright 2015-2016 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. description="consul-template agent"
  5. group=${group:-${SVCNAME}}
  6. pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"}
  7. user=${user:-${SVCNAME}}
  8. command="/usr/bin/${SVCNAME}"
  9. command_args="agent -config-dir=/etc/consul-template.d ${command_args}"
  10. command_background="true"
  11. start_stop_daemon_args="--user ${user} --group ${group} \
  12. --stdout /var/log/${SVCNAME}/${SVCNAME}.log \
  13. --stderr /var/log/${SVCNAME}/${SVCNAME}.log"
  14. depend() {
  15. need net
  16. after net
  17. }
  18. start_pre() {
  19. checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
  20. }
  21. stop() {
  22. # SIGINT is required for graceful shutdown of consul-template
  23. ebegin "Stopping ${SVCNAME}"
  24. start-stop-daemon --stop --signal SIGINT --pidfile "${pidfile}"
  25. eend $?
  26. }