From f8b833720a95b8e0b942fdcfbd3beee0dc90a84d Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 9 Apr 2024 06:06:02 +0200 Subject: [PATCH] bundles/systemd-timers: better exclude_from_monitoring support --- bundles/systemd-timers/files/template.service | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bundles/systemd-timers/files/template.service b/bundles/systemd-timers/files/template.service index ed68677..09c3080 100644 --- a/bundles/systemd-timers/files/template.service +++ b/bundles/systemd-timers/files/template.service @@ -1,3 +1,9 @@ +<% + if config.get('exclude_from_monitoring', False): + monitored = '' + else: + monitored = f'/usr/local/sbin/systemd-timer-monitored {timer} ' +%>\ [Unit] Description=Service for Timer ${timer} After=network.target @@ -15,10 +21,8 @@ WorkingDirectory=${config.get('pwd', '/')} Type=oneshot % if isinstance(config['command'], list): % for command in config['command']: -ExecStart=/usr/local/sbin/systemd-timer-monitored ${timer} ${command} +ExecStart=${monitored}${command} % endfor -% elif config.get('exclude_from_monitoring', False): -ExecStart=${config['command']} % else: -ExecStart=/usr/local/sbin/systemd-timer-monitored ${timer} ${config['command']} +ExecStart=${monitored}${config['command']} % endif