blob: 16ca86e9826888c671e05fc05b2731255bc05445 [file] [log] [blame]
Simon Kelley343b7b42019-04-08 16:50:13 +01001[Unit]
2Description=dnsmasq (%i) - A lightweight DHCP and caching DNS server
3Requires=network.target
4Wants=nss-lookup.target
5Before=nss-lookup.target
6After=network.target
7
8[Service]
9Type=forking
10PIDFile=/run/dnsmasq/dnsmasq.%i.pid
11
12# Test the config file and refuse starting if it is not valid.
13ExecStartPre=/etc/init.d/dnsmasq checkconfig "%i"
14
15# We run dnsmasq via the /etc/init.d/dnsmasq script which acts as a
16# wrapper picking up extra configuration files and then execs dnsmasq
17# itself, when called with the "systemd-exec" function.
18ExecStart=/etc/init.d/dnsmasq systemd-exec "%i"
19
20# The systemd-*-resolvconf functions configure (and deconfigure)
21# resolvconf to work with the dnsmasq DNS server. They're called like
22# this to get correct error handling (ie don't start-resolvconf if the
23# dnsmasq daemon fails to start).
24ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf "%i"
25ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf "%i"
26
27
28ExecReload=/bin/kill -HUP $MAINPID
29
30[Install]
31WantedBy=multi-user.target