Using pg_dump in a cron

Lists: pgsql-general
From: Patrick(dot)FICHE(at)AQSACOM(dot)COM
To: pgsql-general(at)postgresql(dot)org
Subject: Using pg_dump in a cron
Date: 2005-06-02 13:43:35
Message-ID: 1DC6C8C88D09D51181A40002A5286929B23119@intranet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

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(dot)fiche(at)aqsacom(dot)com
tél : 01 69 29 36 18
----------------------------------------------------------------------------
---------------



From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Patrick(dot)FICHE(at)AQSACOM(dot)COM
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using pg_dump in a cron
Date: 2005-06-02 16:06:38
Message-ID: 14662.1117728398@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Patrick(dot)FICHE(at)AQSACOM(dot)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


From: Vivek Khera <vivek(at)khera(dot)org>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using pg_dump in a cron
Date: 2005-06-02 17:27:20
Message-ID: 2A0C3A0C-EA74-42ED-A750-9E2DBA4E66C6@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Jun 2, 2005, at 9:43 AM, Patrick(dot)FICHE(at)AQSACOM(dot)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