Thread: Using pg_dump in a cron

Using pg_dump in a cron

From
Patrick.FICHE@AQSACOM.COM
Date:
Hi all,
 
I'm using PostgreSQL 8.0.2 on Solaris 10.
I would like to manage an automatic backup of my database.
 
Here is the line in the cron :
37 * * * * . $HOME/.profile; pg_dump alis -U postgres -f $AQSADIR/data/backup/alis_data.sql -a -d >/dev/null 2>&1
The dump execution is OK but my user gets a mail containing the following message :
 
Your "cron" job on ALIS
. $HOME/.profile; pg_dump alis -U postgres -f $AQSADIR/data/backup/alis_data.sql -a -d >/dev/null 2>&1
 
produced the following output:
 
stty: : No such device or address
What's wrong with it ?

-------------------------------------------------------------------------------------------
Patrick Fiche
email : patrick.fiche@aqsacom.com
tél : 01 69 29 36 18
-------------------------------------------------------------------------------------------

 

Re: Using pg_dump in a cron

From
Tom Lane
Date:
Patrick.FICHE@AQSACOM.COM writes:
> The dump execution is OK but my user gets a mail containing the =
> following
> message :
>
> Your "cron" job on ALIS
> . $HOME/.profile; pg_dump alis -U postgres -f
> $AQSADIR/data/backup/alis_data.sql -a -d >/dev/null 2>&1
>
> produced the following output:
>
> stty: : No such device or address

> What's wrong with it ?

My bet is the .profile file contains a call of stty ... and of course
stdin is going to be pointing somewhere else than a terminal ...

            regards, tom lane

Re: Using pg_dump in a cron

From
Vivek Khera
Date:

On Jun 2, 2005, at 9:43 AM, Patrick.FICHE@AQSACOM.COM wrote:

Your "cron" job on ALIS
. $HOME/.profile; pg_dump alis -U postgres -f $AQSADIR/data/backup/alis_data.sql -a -d >/dev/null 2>&1
 
produced the following output:
 
stty: : No such device or address
What's wrong with it ?


Your .profile executes the stty command.  Don't do that.  Why do you need stuff from your .profile anyhow?

And why would you drop the output to /dev/null -- you'll never know if your dump fails!  Why bother making one then?

Vivek Khera, Ph.D.

+1-301-869-4449 x806



Attachment

Re: Using pg_dump in a cron

From
Patrick.FICHE@AQSACOM.COM
Date:
Thanks Tom,

You are absolutely right, the commandt stty istrip was the first line of my
.profile...

Regards,
Patrick

----------------------------------------------------------------------------
---------------
Patrick Fiche
email : patrick.fiche@aqsacom.com
tél : 01 69 29 36 18
----------------------------------------------------------------------------
---------------




-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Tom Lane
Sent: jeudi 2 juin 2005 18:07
To: Patrick.FICHE@aqsacom.com
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Using pg_dump in a cron


Patrick.FICHE@AQSACOM.COM writes:
> The dump execution is OK but my user gets a mail containing the =
> following
> message :
>
> Your "cron" job on ALIS
> . $HOME/.profile; pg_dump alis -U postgres -f
> $AQSADIR/data/backup/alis_data.sql -a -d >/dev/null 2>&1
>
> produced the following output:
>
> stty: : No such device or address

> What's wrong with it ?

My bet is the .profile file contains a call of stty ... and of course
stdin is going to be pointing somewhere else than a terminal ...

            regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend