title: ~/Library/LaunchAgents plist runs manually but not automatically
body: <p>I am starting to work with launchd and want to set up a plist file such that whenever I insert an SD card into my Mac mini server (with Snow Leopard Server), I want a shell script to run (which should copy all the jpg files, rename them etc).</p>
  
  <p>So, I created a plist file in the ~/Library/LaunchAgents (see below for its contents - it should be looking for changes to /Volumes) and I created a shell script which says "beep" - later it will do something more useful.</p>
  
  <p>The plist file is registered with launchctl, and when I run it (launchctl start com.peters.runwhenSDmount), the computer says beep whenever a memory card is plugged in, and stays silent when there is no memory card. So, apparantly the plist does call the shell script, which subsequently checks if the specific SD card is there. I assume this also proves that there is no problem with permissions for the SD card.</p>
  
  <p>But, it doesnt seem to run by itself??? Any idea why??</p>
  
  <hr>
  
  <p><strong>plist file:  ~/Library/LaunchAgents/com.peters.runwhenSDmount.plist</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;dict&gt;
      &lt;key&gt;Label&lt;/key&gt;
      &lt;string&gt;com.peters.runwhenSDmount&lt;/string&gt;
      &lt;key&gt;LowPriorityIO&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;ProgramArguments&lt;/key&gt;
      &lt;array&gt;
      &lt;string&gt;/Users/peter/Library/Scripts/runwhenSDmount&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;ThrottleInterval&lt;/key&gt;
      &lt;integer&gt;10&lt;/integer&gt;
      &lt;key&gt;WatchPaths&lt;/key&gt;
      &lt;array&gt;
      &lt;string&gt;/Volumes&lt;/string&gt;
      &lt;/array&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>shell script: ~/Library/Scripts/runwhenSDmount</strong></p>
  
  <pre><code>#!/bin/bash
  if [ -d "/Volumes/NIKON D40X" ]; then
      say beep
  fi
  </code></pre>