[systemd-devel] Scheduling 3 periodic jobs using systemd

Nils Kattenbeck nilskemail at gmail.com
Mon Jul 15 12:58:32 UTC 2024


It might make more sense to create three services. Otherwise you can add
overrides for some of them (e.g. /etc/.../rsnapshot at weekly.service) with
only a [Unit] section containing a Before=/After= declaration

On Mon, Jul 15, 2024, 14:52 <t.schneider at disroot.org> wrote:

> Actually there's no dedicated *.service file for each period, but only 1
> service file:
>
> # cat /etc/systemd/system/rsnapshot at .service
> [Unit]
> Description=rsnapshot (%I) backup
> Requires=backup.mount
> After=backup.mount
>
> [Service]
> Type=oneshot
> Nice=19
> IOSchedulingClass=idle
> ExecStart=/usr/bin/rsnapshot %I
>
>
> Am 2024-07-12 18:59, schrieb Nils Kattenbeck:
>
> The After/Before need to be set in the .service files, not the .timer files
>
> On Fri, Jul 12, 2024, 13:26 <t.schneider at disroot.org> wrote:
>
> Actually this was my idea, too.
>
> However, could you precise what to enter in which file?
>
> I was tanding to relevant *.timer files.
>
>
> Am 2024-07-12 12:43, schrieb Nils Kattenbeck:
>
> If you set proper After/Before dependencies, the units scheduled later
> should wait for the earlier units to finish
>
> On Fri, Jul 12, 2024, 11:10 <t.schneider at disroot.org> wrote:
>
> Setting the time of day requires detailed knowledge about the runtime of
> each job.
>
> But this forecast is not accurate and this means any setting could result
> in same error.
>
>
> Am 2024-07-12 09:29, schrieb Barry:
>
>
>
> On 12 Jul 2024, at 08:19, t.schneider at disroot.org wrote:
>
> This means, one must ensure that these scheduled jobs run sequentially in
> this order:
> monthly - weekly - daily
>
>
> Maybe you can set the time of day so that you get the sequencing.
> Monthly at 01:00, weekly at 03:00 etc
>
> Or you could encode these rules in the script that you run daily.
>
> Barry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240715/4a4d65ec/attachment.htm>


More information about the systemd-devel mailing list