Skip to content

Commit

Permalink
Merge pull request #140 from flyingcircusio/Make-timer-service-config…
Browse files Browse the repository at this point in the history
…urable

Make SystemD timer services configurable
  • Loading branch information
zagy authored Dec 7, 2023
2 parents 22a61ba + d6f96aa commit 804f4f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make it possible to add arbitrary additional configuration to a service created by a SystemdTimer().
6 changes: 6 additions & 0 deletions src/batou_ext/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class SystemdTimer(batou.component.Component):
onCalendar = batou.component.Attribute(str)
timeout = "1h"
description = None
additional_service_config = None
run_as = batou.component.Attribute(
str,
default=batou.component.ConfigString(
Expand Down Expand Up @@ -186,6 +187,11 @@ def configure(self):
User = "{{component.run_as}}";
ExecStart = "{{component.wrapped_command}}";
TimeoutStartSec = "{{component.timeout}}";
{%- if component.additional_service_config is not none %}
{%- for setting, value in component.additional_service_config.items() %}
{{ setting }} = {{ value }};
{%- endfor %}
{%- endif %}
};
};
}
Expand Down

0 comments on commit 804f4f6

Please sign in to comment.