It turns out the setup I posed in my question is correct, and works as expected. This was confirmed by @klanomath, who was able to reproduce my configuration and see things working as expected. Specifically:
After issuing:
$ sudo webappctl start org.apache.tomcat
I get the expected "Here I am!" message in /var/log/system.log
.
The solution for me was to simply restart my machine.
Take note, seemingly, the launchd configurations in /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/
appear to be cached somehow, and changes made there are not picked up by webappctl
until something* is restarted.
Hopefully this will save someone the day it took me to have a gentle "have you tried restarting?" suggestion solve the issue.
Levi
*I'm not sure what needs to be restarted... I tried starting and stopping the webserver and Server.app, enabling and disabling the web app from within Settings.app GUI, with no effect. The only thing which picked up the changes was a full system restart.
I had the similar issue and google led me to this thread. Now I have a solution to the problem if someone else find this.
Just remove the --no-daemon
line.
This seems to work fine:
<?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>Label</key>
<string>homebrew.mxcl.mpd</string>
<key>WorkingDirectory</key>
<string>/usr/local</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/mpd/bin/mpd</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
Best Answer
Make launchd call this AppleScript. It displays a dialog with a timeout and calls a shell script if the user selected "Ok".