How to run a one-liner shell command using launchd?
You want to include this check for network state:

&lt;dict&gt;
  &lt;key&gt;NetworkState&lt;/key&gt;
  &lt;true/&gt;
&lt;/dict&gt;


Also - you probably want to pass in your program args correctly:

&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
    &lt;string&gt;/usr/local/bin/binaryname&lt;/string&gt;
    &lt;string&gt;arg1&lt;/string&gt;
    &lt;string&gt;arg2&lt;/string&gt;
&lt;/array&gt;