Re: Returned mail: User unknown

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Returned mail: User unknown
Date: 1999-08-15 13:55:39
Message-ID: 199908151355.JAA01342@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Actually I have several cron tasks and they bored me emailing
> every night output from psql.
> I need emails only if some problems occur.
> Ok. I could easily redirect all messages to some file if I would
> sure psql returns return code in right way. Then I could
> echo this file if RC != 0
> grep -v will not works because elog messages are printed to STDERR
> so I need something like:
> psql -q test < tt.sql 2>&1 | grep -v '^NOTICE:'
> but then I will lose return code from psql :-)
> Having several flags for different kind of messages would be
> very useful.

OK:

trap "rm -f /tmp/$$" 0 1 2 3 15
psql -q test < tt.sql >/tmp/$$ 2>&1
if [ "$?" -ne 0 ]
then echo "Failure"
fi
cat /tmp/$$ | grep -v '^NOTICE:'

Having different psql flags for different elog levels is a bit much.
psql already has too many flags.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-08-15 14:12:52 psql return code for NOTICE
Previous Message Bruce Momjian 1999-08-15 04:35:52 Re: [HACKERS] How to get 'psql -q' runs really quiet ?