Skip site navigation (1) Skip section navigation (2)

how can I get Error-message from postgresql in linux shell script

From: "rx" <rong(dot)xie(at)stud(dot)tu-muenchen(dot)de>
To: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>,"XIE, Rong" <rong(dot)xie(at)stud(dot)tu-muenchen(dot)de>,<pgsql-docs(at)postgresql(dot)org>
Cc: <pgadmin-support(at)postgresql(dot)org>,"pgadmin-hackers" <pgadmin-hackers(at)postgresql(dot)org>
Subject: how can I get Error-message from postgresql in linux shell script
Date: 2003-03-28 12:23:34
Message-ID: 005901c2f524$da716ed0$16e1f48a@IPSM7N (view raw or flat)
Thread:
Lists: pgadmin-hackerspgadmin-supportpgsql-docs
Messagehallo,

my Name is Rong. I am student at TU-Munich. I have some questions for
Postgresql under SuSe Linux.

I want save something in Postgresql-Table, when I get a fax from "Hylafax".

I insert "

psql -U postgres dbname <<END_OF_INSTR

insert into "CSID_TIF"("CSID","suspens_file","actDatum")
values('0049891234567','test.tif','01.01.2003'))

END_OF_INSTR "

in shell script.

It work very good.

Now I want enhance it.

When there are some error in Postgresql, or There are some Error at insert,
I want give a message per email to me.

But I do not know, how  can I get the Error from Postgresql in Linux Shell
Script.

When an Postgresql-Error is to happen, how can I get the Error-Message-Event
in shell script and send a email to me.

I hope I can get your Help!

Thank you very much!

best regards!

rong

PS: faxrcvd is my shell-script in Hylafax.

#! /bin/sh

psql -U postgres dbname <<END_OF_INSTR

insert into "CSID_TIF"("CSID","suspens_file","actDatum")
values('0049891234567','test.tif','01.01.2003'))

END_OF_INSTR

##end script

----- Original Message -----
From: <pgsql-general-owner(at)postgresql(dot)org>
To: "rx" <rong(dot)xie(at)stud(dot)tu-muenchen(dot)de>
Sent: Thursday, March 27, 2003 4:03 PM
Subject: Stalled post to pgsql-general


> Your message to pgsql-general has been delayed, and requires the approval
> of the moderators, for the following reason(s):
>
> Non-Member Submission from "rx" <rong(dot)xie(at)stud(dot)tu-muenchen(dot)de>
>
> If you do not wish the message to be posted, or have other concerns,
> please send a message to the list owners at the following address:
>   pgsql-general-owner(at)postgresql(dot)org
>


Attachment: faxrcvd.txt
Description: text/plain (7.1 KB)

In response to

pgsql-docs by date

Next:From: Ferindo Middleton JrDate: 2003-03-31 06:30:56
Subject: Newbie: problem Connecting to Server
Previous:From: rxDate: 2003-03-28 12:18:53
Subject: how can I get Error-message from postgresql in linux shell script

pgadmin-hackers by date

Next:From: frank_lupoDate: 2003-03-28 17:47:59
Subject: question abort query
Previous:From: rxDate: 2003-03-28 12:18:53
Subject: how can I get Error-message from postgresql in linux shell script

pgadmin-support by date

Next:From: Julie MayDate: 2003-03-28 19:29:32
Subject: PgMigration error when migrating Dbase tables
Previous:From: rxDate: 2003-03-28 12:18:53
Subject: how can I get Error-message from postgresql in linux shell script

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group