From 03304582f8cbbb14d634498f9c31636452cdf532 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Sun, 29 May 2016 23:10:08 +0100 Subject: [PATCH] systemd: add pidfile support --- cookbooks/systemd/resources/service.rb | 1 + cookbooks/systemd/templates/default/service.erb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cookbooks/systemd/resources/service.rb b/cookbooks/systemd/resources/service.rb index 8ef7dcdbb..39abc608e 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -38,6 +38,7 @@ property :exec_reload, String property :restart, String, :is => %w(on-success on-failure on-abnormal on-watchdog on-abort always) property :timeout_sec, Fixnum +property :pid_file, String action :create do template "/etc/systemd/system/#{name}.service" do diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index ffac55396..57f6a61e7 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -42,6 +42,9 @@ Restart=<%= @restart %> <% if @timeout_sec -%> TimeoutSec=<%= @timeout_sec %> <% end -%> +<% if @pid_file -%> +PIDFile=<%= @pid_file %> +<% end -%> [Install] WantedBy=multi-user.target -- 2.39.5