title: Postgres backup script on Ubuntu + cron
body: <p>i try to get an auto backup script running.</p>
  
  <p>The script works perfectly, if i run it by typing "bash backup.su" into the terminal.
  For every query and operation I have to input the password (database user), but it works fine.</p>
  
  <p>But as soon as I don't use the terminal (eg via cron), it doesn't. It just prints out my logfile without any information.</p>
  
  <p>I think it has something to do with user rights</p>
  
  <p>Terminal output:</p>
  
  <pre><code>Making backup directory in /scripts/2013-09-26-daily 
  
  Performing schema-only backups
  ------------------------------------------
  Password for user backupuser: &lt;- Query getting all databases with certain string in name
  The following databases were matched for schema-only backup:
  
  Performing full backups
  ------------------------------------------
  Password for user backupuser: &lt;- Query getting all databases
  Plain backup of DB1
  Password:
  Plain backup of DB2
  Password:
  Plain backup of AndSoOn
  Password:
  All database backups complete!
  </code></pre>
  
  <p>Cron Log:</p>
  
  <pre><code>Making backup directory in /scripts/2013-09-26-daily/
  
  Performing schema-only backups
  ------------------------------------------
  The following databases were matched for schema-only backup:
  
  Performing full backups
  ------------------------------------------
  
  All database backups complete!
  </code></pre>
  
  <p>As you can see there seems to be no query executed. Right now i'm using a special backup user, but it also doesn't work with postgres. (With the postgres user he also ask for a password... but an empty one stops the script)</p>
  
  <p>Does anybody have a clue for me? As i said it works perfectly manually, bot doesn't with cron.</p>
  
  <p>Greetings</p>
  
  <p>Martin</p>