I have a program I want to run on-demand using launchd
by running the following command:
/usr/local/bin/godoc -http=:6060
This program starts an HTTP app that listens on the designated port 6060.
In my property list I have
<key>Sockets</key>
<dict>
<key>default</key>
<dict>
<key>SockNodeName</key>
<string>localhost</string>
<key>SockServiceName</key>
<integer>6060</integer>
<key>SockPassive</key>
<true/>
</dict>
</dict>
However, when I start the daemon, the output from the application to stderr is:
ListenAndServe :6060: listen tcp :6060: bind: address already in use
From my understanding, launchd
creates the socket and passes it to the app, but this app is trying to create the socket again so it fails.
What options do I have to run this with launchd
on demand?