[systemd-devel] Scheduling 3 periodic jobs using systemd

serenissi serenissi at inventati.org
Sun Jul 14 06:36:54 UTC 2024


Why can't you use After= ?

On 7/12/24 12:42, t.schneider at disroot.org wrote:
>
> 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/20240714/5ffa18c2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x20257A7131FFF28B.asc
Type: application/pgp-keys
Size: 652 bytes
Desc: OpenPGP public key
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240714/5ffa18c2/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240714/5ffa18c2/attachment.sig>


More information about the systemd-devel mailing list