Simon Kelley | 343b7b4 | 2019-04-08 16:50:13 +0100 | [diff] [blame] | 1 | [Unit] |
| 2 | Description=dnsmasq (%i) - A lightweight DHCP and caching DNS server |
| 3 | Requires=network.target |
| 4 | Wants=nss-lookup.target |
| 5 | Before=nss-lookup.target |
| 6 | After=network.target |
| 7 | |
| 8 | [Service] |
| 9 | Type=forking |
| 10 | PIDFile=/run/dnsmasq/dnsmasq.%i.pid |
| 11 | |
| 12 | # Test the config file and refuse starting if it is not valid. |
| 13 | ExecStartPre=/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. |
| 18 | ExecStart=/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). |
| 24 | ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf "%i" |
| 25 | ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf "%i" |
| 26 | |
| 27 | |
| 28 | ExecReload=/bin/kill -HUP $MAINPID |
| 29 | |
| 30 | [Install] |
| 31 | WantedBy=multi-user.target |