Yes, it's a poor choice for the daemon to use SIGHUP, I have found a lot of oddities with this program.<br><br>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?<br>
<br>Anyway, now it works ok, and there is always the possibility of creating a shell script.<br><br>Thank you and good work with systemd, it's fantastic!<br><br><br><div class="gmail_quote">2011/9/19 Lennart Poettering <span dir="ltr"><<a href="mailto:mzerqung@0pointer.de">mzerqung@0pointer.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Mon, 19.09.11 13:25, Juan Orti Alcaine (<a href="mailto:j.orti.alcaine@gmail.com">j.orti.alcaine@gmail.com</a>) wrote:<br>
<br>
> Hello, I'm making a systemd service file for gogoc, a program to create IPv6<br>
> tunnels with Freenet6.net<br>
><br>
> The program gets the network configuration and uses a shell script for<br>
> configuring the interface, and when receives the HUP signal, calls the shell<br>
> script again for shutting down the tunnel, but it needs a few seconds for<br>
> doing this.<br>
><br>
> What's the better way for doing this? at the moment, I do:<br>
><br>
> [Service]<br>
> WorkingDirectory=/var/lib/gogoc<br>
> Type=simple<br>
> EnvironmentFile=-/etc/sysconfig/gogoc<br>
> ExecStart=/usr/bin/gogoc -f /etc/gogoc/gogoc.conf $GOGOC_OPTS<br>
> ExecStop=/bin/kill -s SIGHUP $MAINPID<br>
><br>
> it sends the HUP, but then it kills the daemon immediately, there's no time<br>
> for shutting down the tunnel properly.<br>
> Is correct to put a sleep? It looks awful<br>
> ExecStop=/bin/kill -s SIGHUP $MAINPID; sleep 5<br>
<br>
> What do you think?<br>
<br>
</div></div>ExecStop is supposed to synchronously shut down a service. It's the same<br>
for SysV's "stop" verb.<br>
<br>
I must say I find it quite a poort choice of this software to use SIGHUP<br>
for termination. They should use SIGSTOP for that, as the generally<br>
accepted default meaning for SIGHUP for daemons is to reload<br>
configuration.<br>
<br>
Note that by default systemd sends SIGSTOP to all processes of a service<br>
and waits for a while to ensure the service shuts down. You can<br>
influence the signal sent via KillSignal=. See systemd.service(5) for<br>
more information.<br>
<br>
Lennart<br>
<br>
--<br>
Lennart Poettering - Red Hat, Inc.<br>
<font color="#888888">--<br>
</font><div><div></div><div class="h5">devel mailing list<br>
<a href="mailto:devel@lists.fedoraproject.org">devel@lists.fedoraproject.org</a><br>
<a href="https://admin.fedoraproject.org/mailman/listinfo/devel" target="_blank">https://admin.fedoraproject.org/mailman/listinfo/devel</a><br>
</div></div></blockquote></div><br>