Scheduling 3 periodic jobs using systemd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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@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@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


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux