Add ExecStartPre command to lxc-dnsmasq service unit

When upgrading from an older deployment without the lxc-dnsmaq service
unit it's possible for the lxc-dnsmasq process to have been left in
a defunct state; this is especially true when upgrading as the
background process will have been started as a post-up command within the
lxcbr0 interface configuration. If the service is in a defunct state, or
running without a valid pid file, the systemd service unit will fail to
start.

This change ensures systemd will clean up all processes owned by the
lxc-dnsmaq user with a limited scope of processes matching a regex of
"^dnsmasq" which is only effectuve when the service is not managed by
systemd and in a defunct state.

Change-Id: If183f0b6dfbe0646384cf3bb3b89bc3901643c1e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-11-10 16:00:50 -06:00
parent 65907bdd61
commit 69ab10bee5
No known key found for this signature in database
GPG Key ID: 69FEFFC5E2D9273F

View File

@ -6,13 +6,15 @@ After=syslog.target
After=network.target
[Service]
Type=forking
Type=simple
User=root
{% if lxc_net_manage_iptables | bool %}
ExecStartPre=/usr/local/bin/lxc-system-manage iptables-create
{% endif %}
ExecStartPre=-/usr/bin/killall -u lxc-dnsmasq --regexp "^dnsmasq"
ExecStart=/usr/local/bin/lxc-system-manage dnsmasq-start
ExecStop=-/usr/local/bin/lxc-system-manage dnsmasq-stop