title: Cronjob to run python script that sends email via sSMTP?
body: <p>So, I wrote a very small python script that runs a system command whenever it detects a file being over 0 bytes. Tried to schedule a cronjob to run it, but for whatever reason it doesn't work -- what am I doing wrong??</p>
  
  <p>Python script (/usr/local/bin/urlEmail.py):</p>
  
  <pre><code>#!/usr/bin/env python
  import os
  
  changes = os.stat("/usr/local/bin/changes.txt")
  if changes.st_size &gt; 0:
      os.system('ssmtp email@email.com &lt; changes.txt')
  </code></pre>
  
  <p>(Right now, changes.txt is static and has some text it in just for my testing)</p>
  
  <p>added to crontable -e on root user:</p>
  
  <pre><code>*/1 * * * * urlEmail.py
  </code></pre>
  
  <p>And if I look at /var/log/syslog, I see:</p>
  
  <pre><code>Jun 13 07:09:01 Server CRON[20901]: (root) CMD (urlEmail.py)
  Jun 13 07:09:02 Server sSMTP[20902]: Sent mail for root@email.com  (221 domain.domain.com closing connection) uid=0 username=root outbytes=577
  </code></pre>
  
  <p>Also, just running 'urlEmail.py', I get the email I expect, however, the log message is:</p>
  
  <pre><code>Jun 13 07:17:07 Server sSMTP[20952]: Sent mail for root@email.com (221 domain.domain.com closing connection) uid=0 username=root outbytes=352
  </code></pre>
  
  <p>The only thing that has changed between the two log messages is the fact that in the one where I run 'urlEmail.py' on my own, outbytes value is different.</p>
  
  <p>When the cron runs (once a minute) I'm not getting any emails at all.</p>