From: Tom Hughes Date: Thu, 3 Aug 2023 07:49:53 +0000 (+0100) Subject: Extend systemd service with more directory options X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/f06628a80acfba8c201da23162681647d5b66d59?ds=inline Extend systemd service with more directory options --- diff --git a/cookbooks/systemd/resources/service.rb b/cookbooks/systemd/resources/service.rb index e82b33fb0..728009c3f 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -51,9 +51,17 @@ property :exec_start_post, [String, Array] property :exec_stop, [String, Array] property :exec_stop_post, [String, Array] property :exec_reload, String +property :runtime_max_sec, Integer property :runtime_directory, String property :runtime_directory_mode, Integer -property :runtime_max_sec, Integer +property :state_directory, String +property :state_directory_mode, Integer +property :cache_directory, String +property :cache_directory_mode, Integer +property :logs_directory, String +property :logs_directory_mode, Integer +property :configuration_directory, String +property :configuration_directory_mode, Integer property :standard_input, String, :is => %w[null tty tty-force tty-fail socket] property :standard_output, String, diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index 1172d0b96..fb2427de7 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -115,14 +115,38 @@ ExecReload= <% end -%> ExecReload=<%= @exec_reload %> <% end -%> +<% if @runtime_max_sec -%> +RuntimeMaxSec=<%= @runtime_max_sec %> +<% end -%> <% if @runtime_directory -%> RuntimeDirectory=<%= @runtime_directory %> <% end -%> <% if @runtime_directory_mode -%> RuntimeDirectoryMode=<%= sprintf("0%o", @runtime_directory_mode) %> <% end -%> -<% if @runtime_max_sec -%> -RuntimeMaxSec=<%= @runtime_max_sec %> +<% if @state_directory -%> +StateDirectory=<%= @state_directory %> +<% end -%> +<% if @state_directory_mode -%> +StateDirectoryMode=<%= sprintf("0%o", @state_directory_mode) %> +<% end -%> +<% if @cache_directory -%> +CacheDirectory=<%= @cache_directory %> +<% end -%> +<% if @cache_directory_mode -%> +CacheDirectoryMode=<%= sprintf("0%o", @cache_directory_mode) %> +<% end -%> +<% if @logs_directory -%> +LogsDirectory=<%= @logs_directory %> +<% end -%> +<% if @logs_directory_mode -%> +LogsDirectoryMode=<%= sprintf("0%o", @logs_directory_mode) %> +<% end -%> +<% if @configuration_directory -%> +ConfigurationDirectory=<%= @configuration_directory %> +<% end -%> +<% if @configuration_directory_mode -%> +ConfigurationDirectoryMode=<%= sprintf("0%o", @configuration_directory_mode) %> <% end -%> <% if @standard_input -%> StandardInput=<%= @standard_input %>