title: crontab multiple postgresql issue
body: <p>I'm trying to run a script (automation.sh) automated in crontab.
  (I'm on Ubuntu 14.04).</p>
  
  <pre><code>#!/usr/bin/env bash
  
  day=$(date +%F -d'yesterday')
  
  cat /home/tomi/logs/$day |grep registration &gt; /home/tomi/registrations/$day
  cat /home/tomi/logs/$day |grep free_tree &gt; /home/tomi/free_tree/$day
  cat /home/tomi/logs/$day |grep super_tree &gt; /home/tomi/super_tree/$day
  
  psql -U hello -d postgres -c "\COPY registrations FROM '/home/tomi/registrations/$day' DELIMITER ' '";
  psql -U hello -d postgres -c "\COPY free_tree FROM '/home/tomi/free_tree/$day' DELIMITER ' '";
  psql -U hello -d postgres -c "\COPY super_tree FROM '/home/tomi/super_tree/$day' DELIMITER ' '";
  
  psql -U hello -d postgres -f daily_active_users.sql &gt; /home/tomi/tmp1
  psql -U hello -d postgres -f daily_revenue.sql &gt; /home/tomi/tmp2
  </code></pre>
  
  <p>If I run this script normally from the command line, then the last two lines generate tmp1 and tmp2 with data in them. (That's the expected result.)</p>
  
  <p>However, if I run this very same script in crontab, everything works, but the last two lines generate empty files (tmp1 and tmp2).</p>
  
  <p>The tricky thing is that when I break this script into two scripts (eg. automated.sh and automated2.sh) and run the last two lines in crontab 5 minutes later (via this automated2.sh script), tmp1 and tmp2 are generated correctly, with data in them.</p>
  
  <p>Any idea, what can cause this?</p>