title: Background services on Mac OS X
body: <p>I want to make an OS X app which continuously capture photo in some time interval and send that photo to the server via any service (HTTP/Socket).</p>
  
  <p>I searched about this and get that to achieve the same I need to make a daemon service (using launchd) for mac which will run on background.</p>
  
  <p>But I am still confused with the procedure.</p>
  
  <p>For example, I have created a plist file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;Label&lt;/key&gt;
      &lt;string&gt;com.me.lc1&lt;/string&gt;
      &lt;key&gt;ProgramArguments&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;/Documents/LD/FirstScript.sh&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;OnDemand&lt;/key&gt;
      &lt;false/&gt;
      &lt;key&gt;Nice&lt;/key&gt;
      &lt;integer&gt;1&lt;/integer&gt;
      &lt;key&gt;StartInterval&lt;/key&gt;
      &lt;integer&gt;10&lt;/integer&gt;
      &lt;key&gt;StandardErrorPath&lt;/key&gt;
      &lt;string&gt;/Documents/LD/Error_log.log&lt;/string&gt;
      &lt;key&gt;StandardOutPath&lt;/key&gt;
      &lt;string&gt;/Documents/LD/Output_log.log&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>I copied plist file to ~/Library/LaunchAgents</p>
  
  <p>Then use the command</p>
  
  <pre><code>launchctl load ~/Library/LaunchAgents/com.me.lc1.plist
  </code></pre>
  
  <p>But I am not getting any output now.</p>
  
  <p>For the photo capture, I am using imagesnap (<a href="http://iharder.sourceforge.net/current/macosx/imagesnap/" rel="nofollow noreferrer">Referred</a>):</p>
  
  <pre><code>./imagesnap
  </code></pre>
  
  <p>How can I achieve photo capture and service (HTTP/Socket) implementation in background?</p>
  
  <p>How I can send photo to the server in background?</p>
  
  <p>Need help.</p>