我正在为我的应用程序编写Launchd,以便在OSX中使用KeepAlive SuccessfulExit异常退出时重新启动它

时间:2015-04-02 07:28:58

标签: macos launchd

我正在为我的应用程序编写Launchd,以便在OSX中使用KeepAlive SuccessfulExit异常退出时重新启动它 当我通过强制退出应用程序

来检查它时,它对我不起作用

参见代码

<?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>com.name.myApp</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/al/bin/myApp.sh</string>
    </array>
    <key>KeepAlive</key>
    <dict>
        <key>SuccessfulExit</key>
        <true/>
    </dict>
</dict>
</plist>

1 个答案:

答案 0 :(得分:1)

你已经倒退了。来自launchd.plist(5)

       SuccessfulExit <boolean>
       If true, the job will be restarted as long as the program exits
       and with an exit status of zero.  If false, the job will be
       restarted in the inverse condition.

将密钥设置为<false/>,您应该很好。