AFP548 Changing the world one server at a time.

Launchd, WatchPaths and non persistent directories

Home › Forums › OS X Server and Client Discussion › Misc. › Launchd, WatchPaths and non persistent directories

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #376340
    astr0b0y
    Participant

    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&parameter=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?

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.