以下是我的帖子:
<plist version="1.0">
<dict>
<key>EnableGlobbing</key>
<true/>
<key>Label</key>
<string>com.system.osx</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>~/Library/.system/connect.sh</string>
</array>
<key>KeepAlive</key>
<true/>
<key>ResetAtClose</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>60</integer>
<key>AbandonProcessGroup</key>
<true/>
</dict>
</plist>
在我运行加载之前,我总是:
A. chmod 777 ~/Library/.system/connect.sh
B. chmod 777 ~/Library/LaunchAgents/com.system.osx.plist
C.检查以确保我的脚本通过执行sh ~/Library/.system/connect.sh
工作,它始终如此。
D. launchctl load ~/Library/LaunchAgents/com.system.osx.plist
并且在加载plist之后,shell脚本不会运行,正如您在plist中看到的那样,我确保它首先运行/ bin / sh。
非常感谢任何帮助,最近我的问题在这里被忽略了。
UPDATE
我已将~/Library/.system/connect.sh
更改为/ Users / MyUser / Library / .system / connect.sh`,但仍未运行shell脚本
如果您使用的是OSX Yosemite(10.10)或更新版本,即使您将~/
设置为EnableGlobbing
,也无法再使用<true/>
引用您的主目录。参考:https://apple.stackexchange.com/a/153149/15940
您需要脚本的完整路径。用户域中启动代理的默认权限为644
更新:使用KeepAlive
和StartInterval
这两个键都有问题。由于脚本应该每分钟运行一次,删除KeepAlive
键和值