我正在尝试编写一个每天运行一次的启动脚本,仅在工作日运行。但是一旦我加载脚本,它就会每分钟运行一次,而不是按计划运行。无论我以自己还是超级用户身份加载脚本,都会发生这种情况:
launchctl load ~/Library/LaunchAgents/org.myname.foojob
或者
sudo launchctl load /Library/LaunchDaemons/org.myname.foojob
这是 plist 文件:
org.myname.foojob
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.myname.foojob</string>
<key>ProgramArguments</key>
<array>
<string>/Users/myname/bin/foojob.sh</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>1</integer>
</dict>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>2</integer>
</dict>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>3</integer>
</dict>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>4</integer>
</dict>
<dict>
<key>Hour</key>
<integer>16</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>5</integer>
</dict>
</array>
</dict>
</plist>
我正在使用 Mac OSX 10.4 中的原始内置启动程序运行它。希望 plist 文件有点问题。有人有想法吗?