3 ms·
If you want to create a new systemd unit file you can run: $ sudo systemctl edit --force --full my-scheduled-work@.timer or $ systemctl edit --user --f
by LaSombra 4mo ago
If you want to create a new systemd unit file you can run:
$ sudo systemctl edit --force --full my-scheduled-work@.timer
or
$ systemctl edit --user --force --full my-scheduled-work@.timer
- Fire-Dragon-DoL 4mo agoWhy the @?
- tpmoney 4mo agoSystemd lets you create templates that take an argument in from the scheduled service. It gets that from the value after the @. So you can write a unit file that schedules a task to run say every 3 days and in that unit file reference `jobs/%i`, then put your task in a file in jobs and say `systemctl start every-3-days@script1.sh` to run `script1.sh` on your schedule without needing to create a new unit file for each script. StepCA has a nice write up on their site about using these templates to schedule cert renewals for any arbitrary service
- Fire-Dragon-DoL 4mo agoOh cool, thank you