如何在OS X Sierra启动时运行非brew应用程序

时间:2017-07-28 16:24:55

标签: macos elasticsearch

我必须从源代码安装旧版本的Elasticsearch(2.3.3)。二进制文件位于/opt/local/elasticsearch-2.3.3/bin/我创建了以下文件

/Library/LaunchDaemons/org.elasticsearch.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>org.elasticsearch</string>
        <key>ProgramArguments</key>
        <array>
            <string>/opt/local/elasticsearch-2.3.3/bin/elasticsearch</string>
        </array>
        <key>UserName</key>
        <string>root</string>
<!--         <key>GroupName</key>
        <string>staff</string> -->
        <key>WorkingDirectory</key>
        <string>/opt/local/elasticsearch-2.3.3/bin</string>
        <key>KeepAlive</key>
        <true/>
        <key>RunAtLoad</key>
        <true/>
    </dict>
</plist>
然后我发出以下命令:

sudo launchctl load -w /Library/LaunchDaemons/org.elasticsearch.plist

当我查询sudo launchctl list | grep elastic时,它会返回org.elasticsearch。但是当我检查elasticsearch是否与ps ax | grep elastic一起运行时,它还没有运行。

我的.plist文件有问题吗?

1 个答案:

答案 0 :(得分:0)

  

我的.plist文件有问题吗?

至少缺少$callback因此根本无法运行它。

由于Apple特定的问题,您最好使用https://apple.stackexchange.com/