[systemd-devel] Scheduling 3 periodic jobs using systemd

t.schneider at disroot.org t.schneider at disroot.org
Fri Jul 12 07:12:16 UTC 2024


Hello,
I have a backup job (using rsnapshot) that must be executed daily, 
weekly and monthly.
Therefore I created these systemd-timers:

# /etc/systemd/system/rsnapshot-daily.timer
[Unit]
Description=rsnapshot daily backup

[Timer]
OnCalendar=daily
RandomizedDelaySec=10m
Persistent=true
Unit=rsnapshot at daily.service

[Install]
WantedBy=timers.target

# /etc/systemd/system/rsnapshot-weekly.timer
[Unit]
Description=rsnapshot weekly backup

[Timer]
OnCalendar=weekly
RandomizedDelaySec=10m
Persistent=true
Unit=rsnapshot at weekly.service

[Install]
WantedBy=timers.target

# /etc/systemd/system/rsnapshot-monthly.timer
[Unit]
Description=rsnapshot monthly backup

[Timer]
OnCalendar=monthly
RandomizedDelaySec=10m
Persistent=true
Unit=rsnapshot at monthly.service

[Install]
WantedBy=timers.target

On 07/01/2024 all 3 jobs have been triggered in parallel.
However, rsnapshot can run only once, and therefore 2 jobs have failed 
(rsnapshot creates a lockfile /var/run/rsnapshot.pid).

This means, one must ensure that these scheduled jobs run sequentially 
in this order:
monthly - weekly - daily

Can you please advise how to modify the relevant systemd-timer config 
file to ensure the sequential job execution?

THX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240712/bbcd1751/attachment.htm>


More information about the systemd-devel mailing list