pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Getting rid of postgres output
4+ messages / 4 participants
[nested] [flat]

* Getting rid of postgres output
@ 2006-08-07 14:00  Nicola Mauri <Nicola.Mauri@saga.it>
  0 siblings, 3 replies; 4+ messages in thread

From: Nicola Mauri @ 2006-08-07 14:00 UTC (permalink / raw)
  To: pgsql-admin

I scheduled a dump between two databases, via network:
 
pg_dump --clean -U postgres mydb  | psql -q -h remote_host -d mydb -U 
postgres

I'd like to have no output being generated, unless an error condition 
occurs, so that crond will email me only when something goes really wrong.
Unfortunately I'm getting this output:

 setval 
--------
 551776
(1 row)

 setval 
--------
 340537
(1 row)

 setval 
--------
  10411
(1 row)

and so on........
It seems to be related to some sequences recently added to the database. 
Actually we are getting one 'setval' line for each sequence defined.

Does anyone know how to get rid of this output?
Simply redirecting output is not a great idea, as we may loose some 
precious error messages too; so I think we should prevent this messages to 
being generate at all.
(Postgres 8.1.3 on RHEL4)

Thank You!
Nicola

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Getting rid of postgres output
@ 2006-08-08 16:48  Jim Nasby <jnasby@pervasive.com>
  parent: Nicola Mauri <Nicola.Mauri@saga.it>
  2 siblings, 0 replies; 4+ messages in thread

From: Jim Nasby @ 2006-08-08 16:48 UTC (permalink / raw)
  To: Nicola Mauri <Nicola.Mauri@saga.it>; +Cc: pgsql-admin

First, you need to upgrade to 8.1.4.

You can redirect STDOUT to /dev/null. Error messages will be sent to  
STDERR.

On Aug 7, 2006, at 9:00 AM, Nicola Mauri wrote:
> I scheduled a dump between two databases, via network:
>
> pg_dump --clean -U postgres mydb  | psql -q -h remote_host -d mydb - 
> U postgres
>
> I'd like to have no output being generated, unless an error  
> condition occurs, so that crond will email me only when something  
> goes really wrong.
> Unfortunately I'm getting this output:
>
>  setval
> --------
> 551776
> (1 row)
>
> setval
> --------
> 340537
> (1 row)
>
> setval
> --------
>  10411
> (1 row)
>
> and so on........
> It seems to be related to some sequences recently added to the  
> database. Actually we are getting one 'setval' line for each  
> sequence defined.
>
> Does anyone know how to get rid of this output?
> Simply redirecting output is not a great idea, as we may loose some  
> precious error messages too; so I think we should prevent this  
> messages to being generate at all.
> (Postgres 8.1.3 on RHEL4)
>
> Thank You!
> Nicola
>

--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Getting rid of postgres output
@ 2006-08-08 20:05  Aaron Bono <postgresql@aranya.com>
  parent: Nicola Mauri <Nicola.Mauri@saga.it>
  2 siblings, 0 replies; 4+ messages in thread

From: Aaron Bono @ 2006-08-08 20:05 UTC (permalink / raw)
  To: Nicola Mauri <Nicola.Mauri@saga.it>; +Cc: pgsql-admin

On 8/7/06, Nicola Mauri <Nicola.Mauri@saga.it> wrote:
>
>
> I scheduled a dump between two databases, via network:
>
> pg_dump --clean -U postgres mydb  | psql -q -h remote_host -d mydb -U
> postgres
>
> I'd like to have no output being generated, unless an error condition
> occurs, so that crond will email me only when something goes really wrong.
> Unfortunately I'm getting this output:
>
>  setval
> --------
> 551776
> (1 row)
>
> setval
> --------
> 340537
> (1 row)
>
> setval
> --------
>  10411
> (1 row)
>
> and so on........
> It seems to be related to some sequences recently added to the database.
> Actually we are getting one 'setval' line for each sequence defined.
>
> Does anyone know how to get rid of this output?
> Simply redirecting output is not a great idea, as we may loose some
> precious error messages too; so I think we should prevent this messages to
> being generate at all.
> (Postgres 8.1.3 on RHEL4)
>


Have you tried redirecting standard output to /dev/null and sending the
errors to your email?  For example:

pg_dump --clean -U postgres mydb  | psql -q -h remote_host -d mydb -U
postgres > /dev/null 2> output_to_be_emailed.txt

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Getting rid of postgres output
@ 2006-08-08 21:21  Scott Marlowe <smarlowe@g2switchworks.com>
  parent: Nicola Mauri <Nicola.Mauri@saga.it>
  2 siblings, 0 replies; 4+ messages in thread

From: Scott Marlowe @ 2006-08-08 21:21 UTC (permalink / raw)
  To: Nicola Mauri <Nicola.Mauri@saga.it>; +Cc: pgsql-admin

On Mon, 2006-08-07 at 09:00, Nicola Mauri wrote:
> I scheduled a dump between two databases, via network:
>  
> pg_dump --clean -U postgres mydb  | psql -q -h remote_host -d mydb -U
> postgres
> 
> I'd like to have no output being generated, unless an error condition
> occurs, so that crond will email me only when something goes really
> wrong.
> Unfortunately I'm getting this output:
> 
>  setval 
> --------
> 551776
> (1 row)
> 
> setval 
> --------
> 340537
> (1 row)
> 
> setval 
> --------
>  10411
> (1 row)
> 
> and so on........
> It seems to be related to some sequences recently added to the
> database. Actually we are getting one 'setval' line for each sequence
> defined.

It'll just get worse as your database gets bigger.

What's better is to check the output of the pg_dump / psql command.  If
you're using bash shell, you can do something like:

if ! ( pg_dump --clean -U postgres test > /tmp/pgdump.sql ) ; then 
    echo "failure in backup" | mail -s "backup failed" youremailhere;
fi

if ! ( psql test2 < /tmp/pgdump.sql ) ; then 
    echo "restore failed" | mail -s "restore failed" youremailhere;
fi

or something like that.  you can save the std out like the other poster
pointed out as well.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-08-08 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-07 14:00 Getting rid of postgres output Nicola Mauri <Nicola.Mauri@saga.it>
2006-08-08 16:48 ` Jim Nasby <jnasby@pervasive.com>
2006-08-08 20:05 ` Aaron Bono <postgresql@aranya.com>
2006-08-08 21:21 ` Scott Marlowe <smarlowe@g2switchworks.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox