Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to run a service in 'ondemand' mode, but I can't even get launchctl to register the service.

$ launchctl load /Library/LaunchDaemons/org.fossil-scm.fossil.plist
bind(): Permission denied
bind(): Permission denied
$

As I'm getting a double 'bind' error I believe I've done something wrong with the Sockets configuration in the attached plist.

How do I setup an network(port 8080) launched on-demand service with launchd?

The apple dev documentation for launchd/launchctl/launchd.plist, TN2083 Daemons and Agents, and 'Creating launchd Daemons and Agents' is a bit thin on this.

<?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>inetdCompatibility</key>
 <dict/>
 <key>Label</key>
 <string>org.fossil-scm.fossil</string>
 <key>KeepAlive</key>
 <false/>
 <key>RunAtLoad</key>
 <false/>
 <key>ProgramArguments</key>
 <array>
  <string>/usr/local/fossil/bin/fossil</string>
  <string>http</string>
  <string>/Users/spdegabrielle/fossil-local-repository/myclone.fossil</string>
 </array>
 <key>Sockets</key>
 <dict>
                <key>Listeners</key>
                <array>
                <dict>
                        <key>SockFamily</key>
                        <string>IPv4</string>
                        <key>SockServiceName</key>
                        <string>http-alt</string>
                        <key>SockType</key>
                        <string>stream</string>
                </dict>
                <dict>
                        <key>SockFamily</key>
                        <string>IPv6</string>
                        <key>SockServiceName</key>
                        <string>http-alt</string>
                        <key>SockType</key>
                        <string>stream</string>
                </dict>
                </array>
        </dict>
 <key>UserName</key>
 <string>root</string>
</dict>
</plist>

Note: UserName was added as I thought perhaps I needed to run is in /Library/LaunchDaemons/, rather than my preferred location ~/Library/LaunchAgents

I'm wanting to associate the launchagent with port 8080, but it seems http-alt expects port 591:

$ sudo cat /etc/services |grep http-alt
http-alt    591/udp     # FileMaker, Inc. - HTTP Alternate (see Port 80)
http-alt    591/tcp     # FileMaker, Inc. - HTTP Alternate (see Port 80)
http-alt    8008/udp     # HTTP Alternate
http-alt    8008/tcp     # HTTP Alternate
http-alt    8080/udp     # HTTP Alternate (see port 80)
http-alt    8080/tcp     # HTTP Alternate (see port 80)

The default of http-alt using the name is Filemaker (6!), simple change the SockServiceName to 8080 or you port of choice.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I see that you're trying to attach the process to port 591 (http-alt).

In Mac OS X (as any other Unix) a regular user can't attach any process to ports under 1024, only root can do such operations.

Your guess is right, move the plist over to the general dir at in /System/Library/LaunchDaemons (since this is listening in a socket it makes sense for the plist to be there) and sudo launchctl load the process

share|improve this answer
    
<code>$ sudo cat /etc/services |grep http-alt http-alt 591/udp # FileMaker, Inc. - HTTP Alternate (see Port 80) http-alt 591/tcp # FileMaker, Inc. - HTTP Alternate (see Port 80) http-alt 8008/udp # HTTP Alternate http-alt 8008/tcp # HTTP Alternate http-alt 8080/udp # HTTP Alternate (see port 80) http-alt 8080/tcp # HTTP Alternate (see port 80) –  Stephen Jan 25 '11 at 17:00
    
damn - I need 8080, not 591. –  Stephen Jan 25 '11 at 17:01
    
+1 I wish I could give you 'answered'! your response is a breakthrough! –  Stephen Jan 25 '11 at 17:08
    
answered - I'll ask a new question. –  Stephen Jan 25 '11 at 18:21
    
Cool! Happy to see it worked –  lynxman Jan 25 '11 at 19:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.