[systemd-devel] Allow stop jobs to be killed during shutdown

Andrey Borzenkov arvidjaar at gmail.com
Mon Jan 27 04:25:24 PST 2014


В Mon, 27 Jan 2014 12:15:54 +0000
Colin Guthrie <gmane at colin.guthr.ie> пишет:

> [Mailing list CC'ed again]
> 
> 'Twas brillig, and Andrey Borzenkov at 27/01/14 11:58 did gyre and gimble:
> > В Mon, 27 Jan 2014 11:27:31 +0000
> > Colin Guthrie <gmane at colin.guthr.ie> пишет:
> > 
> >> 'Twas brillig, and Andrey Borzenkov at 26/01/14 17:16 did gyre and gimble:
> >>>>> I guess what we want is to first send SIGTERM only to the systemd
> >>>>> --user process, and only after a timeout start sending SIGTERM to all
> >>>>> the processes in the control group? I.e., wouldn't a ExecStop entry in
> >>>>> user at .service give us the required timeout?
> >>>>>
> >>> Does not work. systemd sends SIGTERM as soon as ExecStop finished.
> >>
> >> Could you not use the same hack that apache httpd needs?
> >>
> >> http://pkgs.fedoraproject.org/cgit/httpd.git/tree/httpd.service#n28
> >>
> > 
> > No.
> > 
> > systemd user instance needs SIGTERM to start "shutdown" procedure.
> > systemd system instance does not allow SIGTERM to be sent to the
> > $MAINPID only. Sending SIGTERM to all processes at the very beginning
> > is wrong.
> 
> Hmm, I thought the bit I quoted which said:
> 
> > ExecStop=/bin/kill -WINCH ${MAINPID}
> 
> could be used to tell the user session to start it's shudown procedure,
> but rather than -WINCH as in the httpd case, we'd just send SIGTERM here
> instead.
> 

Ah, well. So systemd will not allow to say KillMode=none but happily
accepts dummy signal which does nothing. How consistent :)

This could be considered as workaround for a released distro where
user at .service does not do anything useful anyway. Right. Thank you for
an idea!

> But perhaps I'm still missing something and this won't work :(
>

No, I expect it to work. Just losing final "graceful stop" step, but
this should have been handled by systemd user instance already in the
first place.
 


More information about the systemd-devel mailing list