Web lists-archives.com

Re: howto restart a service in postinst script (Stretch and newer)




On 06/08/17 04:43, Sven Hartge wrote:
> Harald Dunkel <harri@xxxxxxxxx> wrote:
>> On Sat, 5 Aug 2017 11:56:07 +0900 Mark Fletcher <mark27q1@xxxxxxxxx> wrote:
>>> On Fri, Aug 04, 2017 at 12:30:25PM +0200, Harald Dunkel wrote:
> 
>>>> What is the right way to restart a service from the postinst
>>>> script for Stretch and newer?
> 
>>> I may be misunderstanding your question but on a system that has 
>>> migrated to systemd, you can restart a service with: 
>>>
>>> systemctl restart <service>
> 
>> I think you missed the point. To run it from a postinst script we need
>> a universal(!) way to restart a service, regardless whether systemd or
>> sysvinit-core or whatever is installed.
> 
> invoke-rc.d does just that and is included in postinst by
> dh_installinit for both SysV-init *and* systemd.

I've only looked through it briefly, but it looks like it invokes the
initscript regardless of whether systemd is in use - systemd can run
init scripts, after all - and so it relies on an init script being
present. I guess that's ok if you're the packager, because you can
provide one.

Regardless, I'd tend to ask packaging questions on debian-mentors.

Richard