[systemd-devel] How to create a timer that will only run once?
Nils Kattenbeck
nilskemail at gmail.com
Thu Aug 29 09:22:00 UTC 2024
I mostly use --on-unit-active for that but if you want to use absolute
times for that you would need to calculate the difference yourself or use
some shell arithmetic (apart from small differences like how clock
adjustments are handled)
Cheers, Nils
On Thu, Aug 29, 2024, 11:15 Lennart Poettering <lennart at poettering.net>
wrote:
> On Di, 27.08.24 17:28, Konstantin Kharlamov (Hi-Angel at yandex.ru) wrote:
>
> > There's a popular usecase of human-readably scheduling a command for
> > laterน. There are multiple non-systemd solutions, but they generally
> > involve running a 3rd party service, such as atd for at.
> >
> > This functional is provided by systemd though, e.g.:
> >
> > systemd-run --user --on-calendar=12:10 systemctl suspend
> >
> > There's just one problem: from now on this command will be running
> > daily, unless you modify the time to include the date. But not only
> > systemd doesn't allow syntax --on-calendar="today 12:10", even if it
> > did that would be prone to mistakes when a user has time 21:32 and they
> > think "I'm gonna schedule a command for today at 00:07", but that isn't
> > actually "today" but "tomorrow".
> >
> > So, isn't there an option or something that would allow a user to
> > specify time without having to worry the timer is going to be executed
> > more than once?
>
> We currently have no mechanism for this. I guess we could extend the
> calendar time syntax with something like this, where we take the
> current time, and then alter it in certain ways you specify. File a
> github RFE issue about this.
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240829/c58eaae9/attachment.htm>
More information about the systemd-devel
mailing list