Macos 使用WatchPaths键启动d.plist:如何设置最小间隔?
如何使用WatchPath键设置launchd.plist脚本的最小间隔 例如,我希望每次目录中出现新文件时都运行脚本,但我希望它最多每小时运行一次 launchd.plist可能如下所示:Macos 使用WatchPaths键启动d.plist:如何设置最小间隔?,macos,launchd,Macos,Launchd,如何使用WatchPath键设置launchd.plist脚本的最小间隔 例如,我希望每次目录中出现新文件时都运行脚本,但我希望它最多每小时运行一次 launchd.plist可能如下所示: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.
<?xml version="1.0" encoding="UTF-8"?>
<!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.me.pytag</string>
<key>ProgramArguments</key>
<array>
<string>/Users/me/bin/pytag.py</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Volumes/Data/Media/Video/Processing/Converted</string>
</array>
<key>StandardOutPath</key>
<string>/dev/null</string>
</dict>
</plist>
标签
org.me.pytag
程序参数
/Users/me/bin/pytag.py
监视路径
/卷/数据/媒体/视频/处理/转换
标准门诊
/dev/null
添加此属性。请注意,整数以秒为单位
<key>ThrottleInterval</key>
<integer>3600</integer>
ThrottleInterval
3600
有关更多属性,请参见此链接