发射似乎忽略了优胜美地上的StartCalendarInterval


9

我尝试按启动时间及时更新Homebrew。我的plist文件显示在这里:

<?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>ms.liu.homebrew.update</string>
  <key>UserName</key>
  <string>LiuMS</string>
  <key>ProcessType</key>
  <string>Background</string>
  <key>EnvironmentVariables</key>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/brew</string>
    <string>update</string>
  </array>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Hour</key>
    <integer>20</integer>
    <key>Minute</key>
    <integer>0</integer>
  </dict>
  <key>StandardOutPath</key>
  <string>/usr/local/logs/ms.liu.homebrew.update.out</string>
  <key>StandardErrorPath</key>
  <string>/usr/local/logs/ms.liu.homebrew.update.err</string>
</dict>
</plist>

它确实以某种方式起作用:我可以launchctl start ms.liu.homebrew.update手动执行以更新我的Homebrew。但是,launchd不会定期执行此服务:stdout重定向到的文件的最后更改是在两天前。

我试图获取有关此服务的信息,但一无所获:

> launchctl print user/%MyPID%/ms.liu.homebrew.update`` 
Could not find service "ms.liu.homebrew.update" in domain for uid: %MyPID%

看来我尚未成功加载我的服务。怎么样?我用过,launchctl load但似乎已弃用。手册页建议使用引导程序:

> launchctl bootstrap user/%MyPID% %Path-to-plist%
> %Path-to-plist%: Service cannot load in requested session

我该怎么办?如何正确使用launchctl bootstraplaunchctl print

我正在配备Retina显示屏(2013)的MacBookPro上运行OS X Yosemite GM Candidate 1。

Answers:


2

我只是开始研究这些东西,所以这个答案是暂定的-但我希望它比根本没有答案更有帮助。(如果我有足够的代表,我会把它留为评论。)

该列表是否在您的~/Library/LaunchAgents目录中?这些似乎引导到您的gui域,而不是您的user域。因此,您可以执行以下操作:

launchctl print gui/%UID%/ms.liu.homebrew.update

它应该工作。(可以?)

您之所以无法将其引导到user域中,可能是因为它已经被引导到gui域中了。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.