Skip to content

Commit effb692

Browse files
committed
Add option WorkingDirectory to service template
1 parent 6474bf3 commit effb692

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ That's all the magic.
3232
| timer_envfile | no | Add environment file |
3333
| timer_user | no | Under which users the timer_command is executed. Default: root |
3434
| timer_persistent | no | Takes a boolean argument. If true, the time when the service unit was last triggered is stored on disk. When the timer is activated, the service unit is triggered immediately if it would have been triggered at least once during the time when the timer was inactive. This is useful to catch up on missed runs of the service when the machine was off. Note that this setting only has an effect on timers configured with OnCalendar=. Defaults to false. [Source](https://www.freedesktop.org/software/systemd/man/systemd.timer.html) |
35+
| timer_workingdir | no | Set [WorkingDirectory=](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#WorkingDirectory=) for the timer
3536
| timer_OnActiveSec | no | Relative time after the timer unit was last activated |
3637
| timer_OnBootSec | no | Relative time after the computer was booted |
3738
| timer_OnStartupSec | no | Relative time after systemd was started |

templates/service.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ Description={{ item.key }} Service
88
[Service]
99
Type=oneshot
1010
{% if item.value.timer_envfile is defined %}
11-
EnvironmentFile={{ item.value.timer_envfile }}
11+
EnvironmentFile={{ item.value.timer_envfile }}
1212
{% endif %}
1313
{% if item.value.timer_precommand is defined %}
14-
ExecStartPre={{ item.value.timer_precommand }}
14+
ExecStartPre={{ item.value.timer_precommand }}
1515
{% endif %}
1616
ExecStart={{ item.value.timer_command }}
1717
{% if item.value.timer_user is defined %}
1818
User={{ item.value.timer_user }}
1919
{% endif %}
20+
{% if item.value.timer_workingdir is defined %}
21+
WorkingDirectory={{ item.value.timer_workingdir }}
22+
{% endif %}

0 commit comments

Comments
 (0)