【发布时间】:2012-04-21 22:17:35
【问题描述】:
我正在尝试使用 launchd 每 10 分钟运行一次 python 脚本。使用 cron 很容易,但我已经尝试了几个小时来了解如何操作 launchd,但我一直没有成功。我正在使用位于/Users/turtle/bin/ 的python 版本。这是我的启动文件 (com.foobar) 的样子:
<?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.foobar</string>
<key>ProgramArguments</key>
<array>
<string>/Users/turtle/bin/python</string>
<string>/Users/turtle/code/baz.py</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>10</integer>
</dict>
</dict>
</plist>
当我跑步时:
launchctl load /Library/LaunchAgents/com.foobar
我明白了:
launchctl: Couldn't stat("/Library/LaunchAgents/com.foobar"): No such file or directory nothing found to load
谁能帮帮我?感谢您的宝贵时间。
【问题讨论】: