dreamcat4 at gmail.com
Thu Aug 19 06:44:59 PDT 2010
On Thu, Aug 19, 2010 at 11:48 AM, Dreamcat4 <dreamcat4 at gmail.com> wrote:
> 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.
Well, that was easy enough
When I do this, launchd does unload the starter job as requested.
However it also report the following error to console:
Aug 19 13:39:44 janitors-Mac-mini com.apple.launchd.peruser.502
(unload): Bug: launchd_core_logic.c:8873 (24108):0
Another thing is that when loading a User-Level job (from
~/Library/LaunchAgents), and specifying:
Launchd reports another error:
janitors-Mac-mini:~ id$ launchctl load -w ~/Library/LaunchAgents/unload.plist
bind(): Permission denied
However "http-alt" is actually port 8080, well above 1024.
That doesnt seem right b/c the launchd.plist documentation refers to
"Daemon/Agent writers" in the Sockets description. So Launch Agents
should be supported.
> On Wed, Aug 18, 2010 at 2:59 PM, Dreamcat4 <dreamcat4 at gmail.com> wrote:
>> 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?
>> (unrelated to the above patch)
>> Im having trouble with getting the inetdCompatibility feature to work.
>> The popular example
>> Which was followed for nginx pretty much verbatem:
>> 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.
>> dreamcat4 at gmail.com
More information about the launchd-dev