Alex Seidlitz
Alex Seidlitz

Reputation: 3736

Starting YAWS using launchd under Mac OS X Yosemite

I am trying to setup Yaws (installed via Homebrew) to start automatically under OS X Yosemite using the following PLIST:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>ca.seidlitz.yaws</string>
        <key>ProgramArguments</key>
        <array>
                <string>sh</string>
                <string>-c</string>
                <string>/usr/local/Cellar/yaws/1.98/bin/yaws --daemon --conf /usr/local/Cellar/yaws/1.98/etc/yaws/yaws.conf</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>WorkingDirectory</key>
        <string>/usr/local/opt/yaws</string>
        <key>StandardOutPath</key>
        <string>/tmp/yaws.log</string>
        <key>StandardErrorPath</key>
        <string>/tmp/yaws_err.log</string>
</dict>
</plist>

I tried to load this plist using sudo launchctl load /Library/LaunchDaemons/ca.seidlitz.yaws.plist
but with no luck. I don't get any error in /var/system.log, while the /tmp/yaws.log contains this error: "1> *** Terminating erlang (nonode@nohost)"

I also tried running it as daemon and in interactive mode. Daemon doesn't generate any errors in the log file but Yaws is not running.

Can anyone spot any issues with the plist?

Upvotes: 0

Views: 242

Answers (1)

Steve Vinoski
Steve Vinoski

Reputation: 20014

You should make the /usr/local/Cellar/yaws/1.98/bin/yaws script executable if it isn't already, get rid of the sh -c invocation, and properly declare the yaws script and its arguments as separate strings, all like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>ca.seidlitz.yaws</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/Cellar/yaws/1.98/bin/yaws</string>
                <string>--daemon</string>
                <string>--conf</string>
                <string>/usr/local/Cellar/yaws/1.98/etc/yaws/yaws.conf</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>WorkingDirectory</key>
        <string>/tmp</string>
        <key>StandardOutPath</key>
        <string>/tmp/yaws.log</string>
        <key>StandardErrorPath</key>
        <string>/tmp/yaws_err.log</string>
</dict>
</plist>

Upvotes: 1

Related Questions