psql return code for NOTICE

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема psql return code for NOTICE
Дата
Msg-id 199908151412.KAA01682@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Returned mail: User unknown  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список 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 15psql -q test < tt.sql >/tmp/$$ 2>&1 if [ "$?" -ne 0 ]then    echo "Failure"ficat /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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Returned mail: User unknown
Следующее
От: "F J Cuberos"
Дата:
Сообщение: Statement Triggers. Ideas & help.