Tarun Kundu | 12e3b2e | 2024-08-15 16:16:53 -0700 | [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=/usr/share/dnsmasq/systemd-helper checkconfig "%i" |
| 14 | |
| 15 | # We run dnsmasq via the /usr/share/dnsmasq/systemd-helper script which acts |
| 16 | # as a wrapper picking up extra configuration files and then execs dnsmasq |
| 17 | # itself, when called with the "exec" function. |
| 18 | ExecStart=/usr/share/dnsmasq/systemd-helper exec "%i" |
| 19 | |
| 20 | # The *-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=/usr/share/dnsmasq/systemd-helper start-resolvconf "%i" |
| 25 | ExecStop=/usr/share/dnsmasq/systemd-helper stop-resolvconf "%i" |
| 26 | |
| 27 | |
| 28 | ExecReload=/bin/kill -HUP $MAINPID |
| 29 | |
| 30 | [Install] |
| 31 | WantedBy=multi-user.target |