Re: how to make systemd wait for a process to die?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, it's a poor choice for the daemon to use SIGHUP, I have found a lot of oddities with this program.

A collateral effect of this is that the router advertisement daemon (radvd) is run as a child and meanwhile gogoc is closing the tunnel, radvd is reloading its configuration, and then dying with SIGKILL, because it never receives a SIGTERM, doesn't it?

Anyway, now it works ok, and there is always the possibility of creating a shell script.

Thank you and good work with systemd, it's fantastic!


2011/9/19 Lennart Poettering <mzerqung@xxxxxxxxxxx>
On Mon, 19.09.11 13:25, Juan Orti Alcaine (j.orti.alcaine@xxxxxxxxx) wrote:

> Hello, I'm making a systemd service file for gogoc, a program to create IPv6
> tunnels with Freenet6.net
>
> The program gets the network configuration and uses a shell script for
> configuring the interface, and when receives the HUP signal, calls the shell
> script again for shutting down the tunnel, but it needs a few seconds for
> doing this.
>
> What's the better way for doing this? at the moment, I do:
>
> [Service]
> WorkingDirectory=/var/lib/gogoc
> Type=simple
> EnvironmentFile=-/etc/sysconfig/gogoc
> ExecStart=/usr/bin/gogoc -f /etc/gogoc/gogoc.conf $GOGOC_OPTS
> ExecStop=/bin/kill -s SIGHUP $MAINPID
>
> it sends the HUP, but then it kills the daemon immediately, there's no time
> for shutting down the tunnel properly.
> Is correct to put a sleep? It looks awful
> ExecStop=/bin/kill -s SIGHUP $MAINPID; sleep 5

> What do you think?

ExecStop is supposed to synchronously shut down a service. It's the same
for SysV's "stop" verb.

I must say I find it quite a poort choice of this software to use SIGHUP
for termination. They should use SIGSTOP for that, as the generally
accepted default meaning for SIGHUP for daemons is to reload
configuration.

Note that by default systemd sends SIGSTOP to all processes of a service
and waits for a while to ensure the service shuts down. You can
influence the signal sent via KillSignal=. See systemd.service(5) for
more information.

Lennart

--
Lennart Poettering - Red Hat, Inc.
--

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux