error messages not getting logged when running script from cron - Mailing list pgsql-general

From anj patnaik
Subject error messages not getting logged when running script from cron
Date
Msg-id CAEQKwSna_Jq8t+4fEqorN-6jcE54YwtqpkEQR0fmSJhcZ_fTaQ@mail.gmail.com
Whole thread Raw
Responses Re: error messages not getting logged when running script from cron  (Kevin Grittner <kgrittn@gmail.com>)
Re: error messages not getting logged when running script from cron  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@comp.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



pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: using a postgres table as a multi-writer multi-updater queue
Next
From: Kevin Grittner
Date:
Subject: Re: error messages not getting logged when running script from cron