我正在为我的应用程序编写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>
答案 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/>
,您应该很好。