From: Grant Slater Date: Sun, 29 May 2016 22:10:08 +0000 (+0100) Subject: systemd: add pidfile support X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/03304582f8cbbb14d634498f9c31636452cdf532?hp=a884ecbc667c29750d26ca2ad8f325f857ead5d3 systemd: add pidfile support --- 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