error messages not getting logged when running script from cron

From: anj patnaik <patna73(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: error messages not getting logged when running script from cron
Date: 2015-11-20 23:09:45
Message-ID: CAEQKwSna_Jq8t+4fEqorN-6jcE54YwtqpkEQR0fmSJhcZ_fTaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a cron script that does the following:

PGPASSWORD=$PGPASSWORD /opt/PostgreSQL/9.4/bin/pg_dump -t RECORDER -Fc $i
-U postgres -Z0 | xz -9 > "$backup_dir/$i-$timeslot-database"

xzcat "$backup_dir/$i-$timeslot-database" |
/opt/PostgreSQL/9.4/bin/pg_restore -h $backupHost -U postgres -d backupDB
-c -p 5434 -v

My cron tab entry:

0 20 * * * db_backup.sh 1> /dev/null 2>&1 | mail -s "backup cron"
myemail(at)comp(dot)com

I am re-directing stderr to stdout and then sending that to email.

I get an email nightly with that title, but no error messages.

Last night, the restore never finished, but there was no error output.

Any ideas to get an email with error info.

thanks a lot

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-11-21 06:00:08 Re: duplicate key errors in log file
Previous Message Jeff Janes 2015-11-20 17:28:28 Re: controlling memory management with regard to a specific query (or groups of connections)