I feel I have searched hard to find out the answers to my questions – just kind find ’em.
I have a simple Launch Agent watching multiple directories using WatchPaths and running a shell command upon change (10.5.7 server).
<?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>Disabled</key>
<true/>
<key>Label</key>
<string>com.plexapp.AutoUpdate</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/curl</string>
<string>-o</string>
<string>/dev/null</string>
<string>--stderr</string>
<string>/dev/null</string>
<string>--silent</string>
<string>--get</string>
<string>http://127.0.0.1:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Volumes/Media</string>
<string>/Volumes/Media2</string>
</array>
</dict>
</plist>
There are two main issues that I have with this function.
1. When directories declared in WatchPaths are not persistent (network share) and they disappear, the agent stops performing the command, even if the directory appears again. Should I be using WatchPaths differently to watch non-persistent directories?
2. WatchPaths does not transverse directories. Under the declared directories I have another 3 levels of directories. Is there a recursive switch I can use?