Re: Getting rid of postgres output

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Nicola Mauri <Nicola(dot)Mauri(at)saga(dot)it>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Getting rid of postgres output
Date: 2006-08-08 21:21:39
Message-ID: 1155072098.20252.63.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrzej B.J.Schulz 2006-08-09 05:23:25 unsubscribe
Previous Message Darcy Buskermolen 2006-08-08 21:00:55 Re: running PostGres without installing it