having a strange issue here. I have ~/Library/LaunchAgents/com.me.helloworld.plist with the following contents:
<?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>com.me.helloworld</string>
<key>ProgramArguments</key>
<array>
<string>/Users/me/temp/test.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/me/temp/Journal.txt</string>
</array>
</dict>
</plist>
The idea is, if ~/temp/Journal.txt is modified, it should execute ~/temp/test.sh. test.sh has the following contents:
#!/bin/bash
echo "hello world from test.sh" >> itchanged.txt
So, if I change Journal.txt, I should get a file called itchanged.txt. When I do the following:
$ launchctl unload ~/Library/LaunchAgents/com.me.helloworld.plist
$ launchctl load ~/Library/LaunchAgents/com.me.helloworld.plist
$ touch Journal.txt
Doing an ls shows that test.txt is not created. However, if I manually do a ./test.sh, then itchanged.txt IS created. So the problem seems to be somewhere in recognizing that Journal.txt is changed and executing the script when this happens.
I am using OS X Mountain Lion. Any ideas?