Bug#794249: systemd: Call ExecReload on timer trigger

Felipe Sateler fsateler at debian.org
Fri Jul 31 19:37:27 BST 2015


Hi,

On 31 July 2015 at 14:07, Ritesh Raj Sarraf <rrs at debian.org> wrote:

> rrs at learner:~$ cat /lib/systemd/system/laptop-mode.service
> [Unit]
> Description=Laptop Mode Tools
>
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=@/usr/sbin/laptop_mode init auto
> ExecStop=@/usr/sbin/laptop_mode init stop
> ExecStopPost=@/bin/rm -f /var/run/laptop-mode-tools/enabled
> ExecReload=@/usr/sbin/laptop_mode auto
> StandardOutput=tty
> StandardError=tty
>
> [Install]
> WantedBy=multi-user.target
> 2015-07-31 / 22:29:33 ♒♒♒  ☺
>
<snip>
> Secondly, I think the timer feature is not working proper. To test my
> use case, I've put a timer to trigger every 150 seconds. But only one
> invocation takes place, that too when I do a service restart for
> laptop-mode.timer.
>
> Apart from that, I see no further invocations.

This is because timers only start units. Because you service has
RemainAfterExit=yes, it is never stopped. Thus, by the time the the
timer should be activated again, the service is already running and so
systemd does nothing.

If you want to use systemd timers, you should probably have a third
unit that has ExecStart=@/usr/sbin/laptop_mode auto and
RemainAfterExit=no, and trigger this unit instead.

-- 

Saludos,
Felipe Sateler




More information about the Pkg-systemd-maintainers mailing list