Simon Kelley | 316e273 | 2010-01-22 20:16:09 +0000 | [diff] [blame] | 1 | This is a launchd item for Mac OS X and Mac OS X Server. |
| 2 | For more information about launchd, the |
| 3 | "System wide and per-user daemon/agent manager", see the launchd |
| 4 | man page, or the wikipedia page: http://en.wikipedia.org/wiki/Launchd |
| 5 | |
| 6 | This launchd item uses the following flags: |
| 7 | --keep-in-foreground - this is crucial for use with launchd |
| 8 | --log-queries - this is optional and you can remove it |
| 9 | --log-facility=/var/log/dnsmasq.log - again optional instead of system.log |
| 10 | |
| 11 | To use this launchd item for dnsmasq: |
| 12 | |
| 13 | If you don't already have a folder /Library/LaunchDaemons, then create one: |
| 14 | sudo mkdir /Library/LaunchDaemons |
| 15 | sudo chown root:admin /Library/LaunchDaemons |
| 16 | sudo chmod 775 /Library/LaunchDaemons |
| 17 | |
| 18 | Copy uk.org.thekelleys.dnsmasq.plist there and then set ownership/permissions: |
| 19 | sudo cp uk.org.thekelleys.dnsmasq.plist /Library/LaunchDaemons/ |
| 20 | sudo chown root:admin /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 21 | sudo chmod 644 /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 22 | |
| 23 | Optionally, edit your dnsmasq configuration file to your liking. |
| 24 | |
Josh Soref | 730c674 | 2017-02-06 16:14:04 +0000 | [diff] [blame] | 25 | To start the launchd job, which starts dnsmasq, reboot or use the command: |
Simon Kelley | 316e273 | 2010-01-22 20:16:09 +0000 | [diff] [blame] | 26 | sudo launchctl load /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 27 | |
| 28 | To stop the launchd job, which stops dnsmasq, use the command: |
| 29 | sudo launchctl unload /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 30 | |
| 31 | If you want to permanently stop the launchd job, so it doesn't start the job even after a reboot, use the following command: |
| 32 | sudo launchctl unload -w /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 33 | |
| 34 | If you make a change to the configuration file, you should relaunch dnsmasq; |
| 35 | to do this unload and then load again: |
| 36 | |
| 37 | sudo launchctl unload /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |
| 38 | sudo launchctl load /Library/LaunchDaemons/uk.org.thekelleys.dnsmasq.plist |