title: How to output stdout and stderr from an exec program script in monit
body: <p>I have a python script that I use as to check certain system conditions to alert on using monit.
  This script prints a buch of stuff during execution to stdout which I want to capture in a log file.
  How should I configure the monit conf script, such that I can capture both the stdout and stderr of this script and at the same time alerting on the exit status of the script. The monit alert should also included the stdout/stderr for the alert events.</p>
  
  <p>This is what I tried</p>
  
  <pre><code>#/etc/monit/conf/myprogram.conf
  
  check program my_program with path "/usr/bin/python -u /opt/program/my_program.py &gt; my_prgoram.log 2&amp;&gt;1"
   if status !=0 alert
  </code></pre>
  
  <p>But I see that the monit always thinks that the program is reporting status=0 even when then it exists with error code 1.</p>
  
  <p>What am i doing wrong?</p>