[launchd-dev] inetdCompatibility
Dreamcat4
dreamcat4 at gmail.com
Thu Aug 19 03:48:30 PDT 2010
I seem to be confused about what this feature actually does.
SSH works because it has a special inetd compatibility flag that will
accept stream based socket connections from stdin (as per telnet).
Wheras Nginx is a more streamlined and optimized kind of webserver,
which would be too slow for operating in that inetd kind of way. Nginx
just wants to be launched and be kept running after the first
incoming connection.
However once launchd loads a job with its Sockets listeners
definition, it will remain bound to that incoming TCP port on behalf
of that launchd job and not let it go.
Im just wondering if its possible to get around all this with a
starter script that can trigger nginx to load (on the first incoming
connection). The starter script would also have to immediately unload
itself from launchd. So as to get launchd to free up the incoming TCP
port(s) for nginx. So the very first http connection might have
to be dropped, however thats not really such a big problem.
Nginx's launchd plist can be configured to start with KeepAlive =>
OtherJobEnabled => false. So to say "start up when the triggering job
unloads itself".
The triggering job would have to stay unloaded for the remainder of
the previous OS session. But can a launchd job be configured to load
itself again during the next boot?
It seems the only way to get the above scenario to work. Short of
reopening the launchd source code for new functionality / features.
On Wed, Aug 18, 2010 at 2:59 PM, Dreamcat4 <dreamcat4 at gmail.com> wrote:
> Hi,
>
> 1.
> There is this patch on the Apple Support forums. Are exporting those
> environment variables the right way to pass the remote ip information
> to the spawned process?
>
> http://discussions.apple.com/thread.jspa?messageID=9360848&tstart=0
>
> 2.
> (unrelated to the above patch)
> Im having trouble with getting the inetdCompatibility feature to work.
>
> The popular example
> /System/Library/LaunchDaemons/ssh.plist
>
> Which was followed for nginx pretty much verbatem:
>
> http://gist.github.com/534777
>
>
> Regardless, Launchd isn't starting nginx when a connection is made to
> http://localhost:8080. The 'http-alt' service is specified in
> "/etc/services" to point to 8080. So as far as I can see, this should
> be no different to Launchd than for triggering a start of sshd.
>
> The behaviour is confounding as Apple sshd will work just fine.
> Flicking inetdCompatibility to Wait => true has no effect either.
> Nothing.
>
>
>
> dreamcat4
> dreamcat4 at gmail.com
>
More information about the launchd-dev
mailing list