Thursday, February 28, 2013

Init.d rc Script to launchd.plist Translator


I know, why embue the heretic Apple platform with any more open-source goodness. But the reality is, there are a shit-ton of developers in the world using OS X relying heavily upon open source services. And yes, one could deploy to a VM you've spun up running CentOS or whatever, but would it not make Linux based services so much attractive to developers if open-source services were available in form native to Mac OS X?

The problem seems to be that no one has the time to understand the thoroughly different approach to agent and daemon management in OS X when adapting their Linux service to the Mac. Unfortunately it is not a simple case of wrapping existing service scripts. There is a semantic mismatch.

Init/rc style scripts implement starting and stopping whereas launchd performs this uniformly for programs as specified by a configuration file. Furthermore, launchd decides when to start, stop or re-start programs and requires that the program not actually do things that classic daemons do, like run in the background and direct standard output to /dev/null.

So unless somebody takes the time to extract the intent of service launching scripts, we get open-source services [hello JBoss!] on OS X that just don't fit well on our development machines.


References

launchd on Wikipedia

launchd source code - Apple re-released the source code under Apache license in hopes open-source crowd might adopt it as a replacement for init, rc, init.d, rc.d, inetd, xinetd, atd, and crond.

launchctl(1) - Manual page for launchctl, the user interface for launchd,

launchd.plist(5) - Manual page for the data specifying a job to be managed by launchd.

No comments:

Post a Comment