From b95a0894e495cc49ef5901ca831589d3b5b97be6 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Tue, 3 Dec 2024 13:02:25 +0000 Subject: [PATCH] systemd: add StopWhenUnneeded service 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 3a9f0b893..11ca0e28c 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -106,6 +106,7 @@ property :memory_deny_write_execute, [true, false] property :restrict_realtime, [true, false] property :restrict_suid_sgid, [true, false] property :remove_ipc, [true, false] +property :stop_when_unneeded, [true, false] property :system_call_filter, [String, Array] property :system_call_architectures, [String, Array] property :tasks_max, Integer diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index 197d8bddf..92d70de85 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -25,6 +25,9 @@ Requires=<%= Array(@requires).join(" ") %> <% if @joins_namespace_of -%> JoinsNamespaceOf=<%= Array(@joins_namespace_of).join(" ") %> <% end -%> +<% if @stop_when_unneeded -%> +StopWhenUnneeded=<%= @stop_when_unneeded %> +<% end -%> [Service] <% if @type -%> -- 2.39.5