Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-24 Thread Adrian Klaver
On 11/23/2015 04:33 PM, anj patnaik wrote: I am seeing a bizarre behavior. The command works fine when called directly from prompt, but when invoked via cron, there is no output nor mail. This works fine: script 2>&1 | tee /tmp/ff ; mailx -s "email" -myem...@company.com

Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-24 Thread anj patnaik
I am seeing a bizarre behavior. The command works fine when called directly from prompt, but when invoked via cron, there is no output nor mail. This works fine: script 2>&1 | tee /tmp/ff ; mailx -s "email" -myem...@company.com < /tmp/ff Now, I place the identical line in crontab file and the

[GENERAL] error messages not getting logged when running script from cron

2015-11-23 Thread anj patnaik
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

Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-23 Thread Kevin Grittner
On Fri, Nov 20, 2015 at 5:09 PM, anj patnaik wrote: > 0 20 * * * db_backup.sh 1> /dev/null 2>&1 | mail -s "backup cron" > myem...@comp.com > > I am re-directing stderr to stdout and then sending that to email. But you are redirecting stdout (and therefore also stderr) to

Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-23 Thread Tom Lane
anj patnaik writes: > My cron tab entry: > 0 20 * * * db_backup.sh 1> /dev/null 2>&1 | mail -s "backup cron" > myem...@comp.com > I am re-directing stderr to stdout and then sending that to email. Uh, read it again: you're redirecting stdout to /dev/null and then redirecting

Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-23 Thread Melvin Davidson
You could also try tweaking the following attached backup script. Caution, I wrote this quickly from a skeleton script and has not been tested. On Mon, Nov 23, 2015 at 3:21 PM, Tom Lane wrote: > anj patnaik writes: > > My cron tab entry: > > > 0 20 * * *

Re: [GENERAL] error messages not getting logged when running script from cron

2015-11-23 Thread John R Pierce
On 11/23/2015 12:21 PM, Tom Lane wrote: >0 20 * * * db_backup.sh 1> /dev/null 2>&1 | mail -s "backup cron" >myem...@comp.com >I am re-directing stderr to stdout and then sending that to email. Uh, read it again: you're redirecting stdout to /dev/null and then redirecting stderr to go where