pg_dump cannot connect when executing by a script

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_dump cannot connect when executing by a script
Date: 2010-05-25 10:43:00
Message-ID: 201005251243.01255.fluca1978@infinito.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I've found in the net a lot of problems similar to mine, but not the solution
for my case: when I executed pg_dump against a database from a script (that
will be executed by cron) I got the following error:

pg_dump: [archiver (db)] connection to database "webcalendardb" failed: could
not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

and the line the script is executing is the following:

/usr/local/bin/pg_dump -f
/backup/sedeldap/postgresql//webcalendardb2010_05_25.sql -h sedeldapa -U
postgres webcalendardb

and of course, if executed interactively, the above line works. The pg_dump is
for 8.4.0 (installed from freebsd ports).
Moreover, if in the script I add the option -F t than the script complains
that:

pg_dump: too many command-line arguments (first is "webcalendardb")

and of course the following:
/usr/local/bin/pg_dump -F t-f
/backup/sedeldap/postgresql//webcalendardb2010_05_25.sql -h sedeldap -U
postgres webcalendardb

works.

Any idea? The only thing I suspect is that I change the IFS in the shell
script, but I also restore it back before trying to pg_dump.

Luca

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Leif Biberg Kristensen 2010-05-25 10:45:09 Re: uppdate from postgersql 8.3.7 to 8.4.4
Previous Message Bogdan Gusiev 2010-05-25 10:20:31 EXECUTE and FOUND