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.