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

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: anj patnaik <patna73(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: error messages not getting logged when running script from cron
Date: 2015-11-23 20:20:33
Message-ID: CACjxUsNQ+OTKtZvj_EdxQUGbmdWQrBD_jhCOsP+hnsYRU31OSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 20, 2015 at 5:09 PM, anj patnaik <patna73(at)gmail(dot)com> wrote:

> 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.

But you are redirecting stdout (and therefore also stderr) to
/dev/null -- therefore there is no body input to the mail command.

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

In that case you will probably be fine if you remove "1> /dev/null"
from the command.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-11-23 20:21:12 Re: error messages not getting logged when running script from cron
Previous Message John R Pierce 2015-11-23 18:54:58 Re: using a postgres table as a multi-writer multi-updater queue