69ab10bee5
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>
44 lines
1.0 KiB
Django/Jinja
44 lines
1.0 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
|
|
[Unit]
|
|
Description=lxc dnsmasq service
|
|
After=syslog.target
|
|
After=network.target
|
|
|
|
[Service]
|
|
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
|
|
|
|
{% if lxc_net_manage_iptables | bool %}
|
|
ExecStopPost=-/usr/local/bin/lxc-system-manage iptables-remove
|
|
{% endif %}
|
|
|
|
PIDFile=/run/lxc/dnsmasq.pid
|
|
|
|
# Give a reasonable amount of time for the server to start up/shut down
|
|
TimeoutSec=120
|
|
Restart=on-failure
|
|
RestartSec=2
|
|
|
|
# This creates a specific slice which all services will operate from
|
|
# The accounting options give us the ability to see resource usage through
|
|
# the `systemd-cgtop` command.
|
|
Slice=lxc-dnsmasq.slice
|
|
CPUAccounting=true
|
|
BlockIOAccounting=true
|
|
MemoryAccounting=false
|
|
TasksAccounting=true
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|