[systemd-devel] Why ExecStop when service receives SIGTERM?

Felipe Gasper felipe at felipegasper.com
Mon Mar 18 19:45:40 UTC 2019



> On Mar 18, 2019, at 3:39 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
> 
> 
> 
> Am 18.03.19 um 20:23 schrieb Felipe Gasper:
>>> On Mar 18, 2019, at 2:54 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
>>> 
>>> Am 18.03.19 um 19:27 schrieb Felipe Gasper:
>>>> 	I’m noticing that ExecStop handlers execute not merely as a means for systemd to stop a Service but also when that Service’s main process receives SIGTERM.
>>>> 
>>>> 	The documentation (systemd.service) says that ExecStop commands are how systemd stops the service; it’s not at all intuitive from that, IMO, that these would also run when something _else_ stops the service.
>>>> 
>>>> 	Am I missing something in the documentation, or is this a bug?
>>>> 
>>>> 	I’m running release 219.
>>> 
>>> 219 sounds like CentOS/RHEL 7
>>> 
>>> at least httpd has a patch for "type=notify" which also results in
>>> "apachectl graceful" showing systemd service reload other than on
>>> unpatched httpd
>>> 
>>> so i guess that behavior has something to to with direct support of
>>> systemd and type=notify
>> 
>> Yeah, I’m on CentOS 7.
>> 
>> Are you saying that this is a bug that later systemd releases have fixed?
> 
> no, i try to explain the behavior from my expierience and won't call it
> a bug at all

But you do agree that this is undocumented behavior, right? The docs only say that ExecStop is how systemd stops the service, right? I don’t see anything that indicates that ExecStop commands fire in response to something *else* taking the service down.

-F


More information about the systemd-devel mailing list