Re: systemd unit timer

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

 



On So, 09.08.20 00:20, Vini Harimoorthy (vini6452@xxxxxxxxx) wrote:

> Hi Team,
>
>
> Is there a way to specify the "start  date & time" of the timer unit with
> calendar timer  ?
>
> For example, the below timer units runs every weekly from the service is
> activated.My requirement is that I need to run the timer unit only after
> the 10th month i.e."2020-10-1"

We currently have no nice mechanism for that. You can hack something up
though: define three timer units: the first one runs the service the
first time, the second one starts it then regularly. And  the third
one then stops the second one.

e.g.

first-start.timer:
    [Timer]
    OnCalendar=2020-10-1
    Unit=myservice.service

regular-start.timer:
    [Timer]
    OnCalendar=weekly
    Unit=myservice.service

myservice.service:
    [Unit]
    Wants=regular-start.timer final.timer

    [Service]
    …

final.timer
    [Timer]
    OnCalendar=2021-8-1
    Unit=stop-final.service

stop-final.service
    [Service]
    ExecStart=/usr/bin/systemctl --no-block stop final.timer
    Type=oneshot

Or something like that. You get the idea.

That said, I think adding a new concept of NotBefore= and NotAfter= to
.timer units would make a ton of sense. Please file an RFE issue on
github asking for this to be added. With a concept like this we could
then just have a new syntax:

     [Timer]
     NotBefore=2020-10-1
     NotAfter=2021-8-1
     OnCalendar=weekly

I think such an addition would make a ton of sense.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




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

  Powered by Linux