mac定时任务

<?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>anjsoft.xxxx.plist</string>
<key>ProgramArguments</key>
<array>
<string>xxxx.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>KeepAlive</key>
<false/>
<key>LaunchOnlyOnce</key>
<false/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

plist脚本存放路径为/Library/LaunchDaemons或/Library/LaunchAgents,其区别是后一个路径的脚本当用户登陆系统后才会被执行,前一个只要系统启动了,哪怕用户不登陆系统也会被执行.

一个是使用StartInterval,它指定脚本每间隔多长时间(单位:秒)执行一次;另外一个使用StartCalendarInterval,它可以指定脚本在多少分钟、小时、天、星期几、月时间上执行,类似如crontab的中的设置

上一篇:css样式表:样式分类,选择器。样式属性,格式与布局


下一篇:Google分布式构建软件之二:构建系统如何工作