title: cron job to execute script and email errors
body: <p>I have a python script in <code>/usr/share/myscript.py</code></p>
  
  <p>I want to execute this script from a cron job, which if the script produces any errors, emails these errors to a specific user (and does not inform the root account).</p>
  
  <p>I do not want to over-ride any of the cron settings - other cron jobs should still notify root.</p>
  
  <p>Currently I am using a shell wrapper, which should pipe errors to a log file and then email it to me. The cron job then executes this .sh file rather than the python script directly.</p>
  
  <pre><code>#!/bin/sh
  python /usr/share/scripts/myscript.py 2&gt;&amp;1 &gt; /home/me/logs/myscript.log
  test -s /home/me/logs/myscript.log &amp;&amp; cat /home/me/logs/myscript.log | mail -s "myscript errors" bob@myplace.com
  </code></pre>
  
  <p>In production, if nothing goes wrong, then the script executes correctly and nobody is emailed. However, if there is an error in the execution of the python script, then this is still being emailed to the root user from cron.</p>
  
  <p>How should I change the .sh script to suppress this and report to me instead?</p>