I needed to get snmpd to start up at boot time on a Darwin box, so I had to delve into Apple’s way of handling rc/init scripts.
All the stuff lives in /System/Library/StartupItems with a directory for each service.
[/System/Library/StartupItems]:: ls -F
Accounting/ Cleanup/ IPServices/ SSH/
Apache/ ConfigServer/ NFS/ SecurityServer/
AppServices/ CrashReporter/ Network/ Sendmail/
AppleShare/ Cron/ NetworkTime/ SystemLog/
AppleTalk/ DirectoryServices/ Portmap/ SystemTuning/
AuthServer/ Disks/ SNMP/
So I copied the SSH directory and made some changes to its contents (three files, all contained in the linked archive below).
[/System/Library/StartupItems]:: ls -FR SNMP
Resources/ SNMP* StartupParameters.plist
SNMP/Resources:
English.lproj/
SNMP/Resources/English.lproj:
Localizable.strings
As you can see, SNMP is the executable script, Resources is a directory with another inside it, and the other is a text file. The text files just need to be modified to reflect what they’re associated with (in this case, the snmp daemon).
You then add a line to /etc/hostconfig that the startup script will look for:
SNMP=-YES-
This was patterned after the existing startup stuff.
I have tested it and it works just fine. I’m glad it was that easy. You can see the results here.
There are some more, um, informed docs on this here.
<addendum, June 7 >
Well, I may have oversimplified this: it seems there is more than one place for StartupItems, and I of course chose the wrong one.
Creed Erickson of Apple’s Software Engineering Operations team sent this to the open-darwin discussion list:
Locally supplied startup items–as opposed to Apple supplied items–should be in /Library/StartupItems rather than in /System/Library/StartupItems.
However, it’s not clear how to handle that on a pure Darwin system, ie w/o Aqua and therefore not OS X: there is no /Library/StartupItems. Am I supposed to create it?