How to install and enable timer units in a package?

Felipe Sateler fsateler at debian.org
Tue Dec 13 18:45:38 GMT 2016


On 13 December 2016 at 15:16, Gioele Barabucci <gioele at svario.it> wrote:
> On 13/12/2016 13:58, Felipe Sateler wrote:
>> On 12 December 2016 at 17:40, Gioele Barabucci <gioele at svario.it> wrote:
>>> My open question now is: how does one enable/start the installed timer
>>> unit "in the right way"?
>>>
>>> Should I use a postinst maintscript to manually enable and start the
>>> timer or are there other and better facilities that I can use?
>>
>> You should just use dh_systemd_enable/dh_systemd_start. If you are
>> using short-form dh, passing --with systemd will do the trick in
>> compat <=9, compat >= 10 enables the systemd sequence by default.
>
> Hi Felipe,
>
> thank you for your answer. Indeed everything works fine using
> `--with=systemd`.

Great!

>
> I have found only a minor thing that makes me wonder if timer units
> should be treated specially by `deb-systemd-invoke`. After the package
> has been installed, `postinst` runs `deb-systemd-invoke` that warns the
> user:
>
>> app.service is a disabled or a static unit, not starting it.
>
> For "Type=oneshot" services used with timers that is the intended
> behaviour. Maybe one could silence this warning message in that case.
> Should I file a bug?

I'm not so sure where, though. While the warning seems superfluous to
me (thus pointing to a bug in init-system-helpers), it seems to me the
really correct thing would be for the maintainer script to never try
starting the service in the first place (and thus the bug being in
debhelper).


-- 

Saludos,
Felipe Sateler




More information about the Pkg-systemd-maintainers mailing list