OS X Server Daemon
I set up a new Ookla server on my Mac Mini. Everything was working well, but the server would not start automatically upon boot. My goal was to run this headless, so I wanted to be able to plug it in and fire it up without having to log in and start the daemon manually.
After much research, I found the way to do it, and will share the code I used.
This particular Mini is running OS X 10.9.5 Mavericks.
Assuming you have installed the LAMP package and Ookla server and licenses, we will proceed to add the daemon to OS X.
Create a plist file
OS X uses the /Library/LaunchDaemons files to start daemons as the root user.
Create a plist file with an appropriate name, I used com.ookla.start.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.ookla.start</string> <key>ProgramArguments</key> <array> <string>/Library/WebServer/Documents/OoklaServer</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
Once the file is created in the /Library/LaunchDaemons folder, we can add to the launchctl list (use sudo, so the daemon is run as root).
sudo launchctl load com.ookla.start.plist
You can also view the list. Since mine is running, it also shows the PID.
sudo launchctl list | grep okla 82 - com.ookla.start
To stop the daemon from loading, do the following.
sudo launchctl unload com.ookla.start.plist
Special thanks to Alvin Alexander for the tips to get this working!
Here’s a 1 Gig speedtest via GPON to my Mac Mini Server.