how to make systemd wait for a process to die?

Juan Orti Alcaine j.orti.alcaine at gmail.com
Mon Sep 19 11:25:41 UTC 2011


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/devel/attachments/20110919/46a8bdf7/attachment.html 


More information about the devel mailing list