Re: [systemd-devel] Dynamic .timer scheduling

2020-03-31 Thread Lennart Poettering
On Di, 28.01.20 10:46, Johannes Ernst (johannes.er...@gmail.com) wrote:

> Is there a best practice for scheduling .timers based on what happened in a 
> previous run?
>
> Pseudocode:
>
> while( true ) :
> delta = runService();
> sleep( delta );
>
> I can think of …
>
> 1) run the job frequently, but skip the bulk of its execution most of the 
> time (e.g. decrementing a counter saved somewhere)
> 2) have the job modify the .timer file at the end of each run (sounds … not 
> so great)
>
> There isn’t anything systemd “native” for that, right?

Consider just creating a transient timer unit via the D-Bus API from
your service code. Alternatively, use systemd-run for that, which can
do that for you from the cmdline.

Lennart

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


Re: [systemd-devel] Dynamic .timer scheduling

2020-01-29 Thread Andrei Borzenkov
28.01.2020 21:46, Johannes Ernst пишет:
> Is there a best practice for scheduling .timers based on what happened in a 
> previous run?
> 
> Pseudocode:
> 
> while( true ) :
> delta = runService();
> sleep( delta );
> 
> I can think of …
> 
> 1) run the job frequently, but skip the bulk of its execution most of the 
> time (e.g. decrementing a counter saved somewhere)
> 2) have the job modify the .timer file at the end of each run (sounds … not 
> so great)
> 

I can only think of creating transient timer with systemd-run
--on-unit-inactive=delta.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Dynamic .timer scheduling

2020-01-28 Thread Johannes Ernst
Is there a best practice for scheduling .timers based on what happened in a 
previous run?

Pseudocode:

while( true ) :
delta = runService();
sleep( delta );

I can think of …

1) run the job frequently, but skip the bulk of its execution most of the time 
(e.g. decrementing a counter saved somewhere)
2) have the job modify the .timer file at the end of each run (sounds … not so 
great)

There isn’t anything systemd “native” for that, right?

Thanks,




Johannes.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel