pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dumpall in crontab doesn't work
8+ messages / 6 participants
[nested] [flat]

* pg_dumpall in crontab doesn't work
@ 2002-07-02 06:47 Werner Modenbach <modenbach@alc.de>
  2002-07-02 07:39 ` Re: pg_dumpall in crontab doesn't work Nils Höglund <nils@naqua.se>
  0 siblings, 1 reply; 8+ messages in thread

From: Werner Modenbach @ 2002-07-02 06:47 UTC (permalink / raw)
  To: pgsql-admin

I'm doing some backup action for my database using crontab. Unfortunately 
the following entry doesn't work and I can't figure out the problem:
----------------------------- /etc/crontab ---------------------------
05 22 *  *  1-5 postgres /usr/bin/pg_dumpall -D > 
/disks/postgres/db.pg_dumpall
----------------------------------------------------------------------

The message I get is:

---------------------------- stderr ----------------------------------
connected to template1...
/usr/bin/pg_dumpall: 0: Bad file descriptor
----------------------------------------------------------------------

The outputfile looks like:

----------------------- the output file ------------------------------
--
-- pg_dumpall (7.2)   -D
--
\connect template1
DELETE FROM pg_shadow WHERE usesysid <> (SELECT datdba FROM pg_database 
WHERE datname = 'template0');

CREATE USER "werner" WITH SYSID 100 CREATEDB CREATEUSER;
CREATE USER "martin" WITH SYSID 101 NOCREATEDB NOCREATEUSER;
CREATE USER "juergen" WITH SYSID 102 CREATEDB NOCREATEUSER;
CREATE USER "www" WITH SYSID 103 NOCREATEDB NOCREATEUSER;
CREATE USER "procad" WITH SYSID 99 NOCREATEDB NOCREATEUSER;

DELETE FROM pg_group;
----------------------------------------------------------------------

That's all. No databases dumped. Calling pg_dumpall manually works fine.
Whe is the problem? Any hints?

- Werner -







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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 06:47 pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
@ 2002-07-02 07:39 ` Nils Höglund <nils@naqua.se>
  2002-07-02 07:50   ` Re: pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
  0 siblings, 1 reply; 8+ messages in thread

From: Nils Höglund @ 2002-07-02 07:39 UTC (permalink / raw)
  To: Werner Modenbach <modenbach@alc.de>; +Cc: pgsql-admin


> 05 22 *  *  1-5 postgres /usr/bin/pg_dumpall -D > 
> /disks/postgres/db.pg_dumpall
> connected to template1...
> /usr/bin/pg_dumpall: 0: Bad file descriptor

Filedescriptor 0 is STDIN. I would guess pg_dumpall want's to read something
from stdin, pherhaps ask you a question?

-- 
/Nils Höglund, Naqua KB

E-mail:         nils@naqua.se
Web:            http://www.naqua.se/
Home Phone:     +46 (0)18  30 09 19
Cellular Phone: +46 (0)709 91 97 65
Address:        Nya Valsätrav. 26 B
                SE-756 46
                Uppsala, Sweden





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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 06:47 pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
  2002-07-02 07:39 ` Re: pg_dumpall in crontab doesn't work Nils Höglund <nils@naqua.se>
@ 2002-07-02 07:50   ` Werner Modenbach <modenbach@alc.de>
  2002-07-02 13:32     ` Re: pg_dumpall in crontab doesn't work Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Werner Modenbach @ 2002-07-02 07:50 UTC (permalink / raw)
  To: pgsql-admin

Nils Höglund wrote:

> 
>> 05 22 *  *  1-5 postgres /usr/bin/pg_dumpall -D > 
>> /disks/postgres/db.pg_dumpall
>> connected to template1...
>> /usr/bin/pg_dumpall: 0: Bad file descriptor
> 
> Filedescriptor 0 is STDIN. I would guess pg_dumpall want's to read 
something
> from stdin, pherhaps ask you a question?
> 
But it doesn't ask in interactive (shell) mode.





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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 06:47 pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
  2002-07-02 07:39 ` Re: pg_dumpall in crontab doesn't work Nils Höglund <nils@naqua.se>
  2002-07-02 07:50   ` Re: pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
@ 2002-07-02 13:32     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Tom Lane @ 2002-07-02 13:32 UTC (permalink / raw)
  To: Werner Modenbach <modenbach@alc.de>; +Cc: pgsql-admin

Werner Modenbach <modenbach@alc.de> writes:
>> Filedescriptor 0 is STDIN. I would guess pg_dumpall want's to read 
>> something from stdin, pherhaps ask you a question?
>> 
> But it doesn't ask in interactive (shell) mode.

I was going to suggest that it's trying to read a password.  Are you
sure you don't have password authentication enabled?

You might try adding < /dev/null to the cron entry.  I would have thought
that would be the default, but perhaps it isn't on your machine.

			regards, tom lane





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

* Re: pg_dumpall in crontab doesn't work
@ 2002-07-02 12:09 Guthrie, John <JGuthrie@air.org>
  2002-07-02 13:45 ` Re: pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
  2002-07-02 14:13 ` Re: pg_dumpall in crontab doesn't work Kevin Brannen <kevinb@nurseamerica.net>
  0 siblings, 2 replies; 8+ messages in thread

From: Guthrie, John @ 2002-07-02 12:09 UTC (permalink / raw)
  To: pgsql-admin

keep in mind that cronjobs don't get your login environment, so things that
work in interactive mode often fail in cron unless you make sure to set up
the environment there too.

john guthrie

-----Original Message-----
From: Werner Modenbach [mailto:modenbach@alc.de]
Sent: Tuesday, July 02, 2002 3:51 AM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] pg_dumpall in crontab doesn't work


Nils Höglund wrote:

> 
>> 05 22 *  *  1-5 postgres /usr/bin/pg_dumpall -D > 
>> /disks/postgres/db.pg_dumpall
>> connected to template1...
>> /usr/bin/pg_dumpall: 0: Bad file descriptor
> 
> Filedescriptor 0 is STDIN. I would guess pg_dumpall want's to read 
something
> from stdin, pherhaps ask you a question?
> 
But it doesn't ask in interactive (shell) mode.



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly






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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 12:09 Re: pg_dumpall in crontab doesn't work Guthrie, John <JGuthrie@air.org>
@ 2002-07-02 13:45 ` Werner Modenbach <modenbach@alc.de>
  2002-07-02 15:38   ` Re: pg_dumpall in crontab doesn't work Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 1 reply; 8+ messages in thread

From: Werner Modenbach @ 2002-07-02 13:45 UTC (permalink / raw)
  To: pgsql-admin

Guthrie, John wrote:

> keep in mind that cronjobs don't get your login environment, so things 
that
> work in interactive mode often fail in cron unless you make sure to set up
> the environment there too.
> 
Thanks John,

actually I didn't know that :-(
In the meantime I added the "</dev/null" as proposed by Tom and it works 
fine now :-))
Seems like pg_dump needs it. Maybe this can be improved in future?

- Werner -





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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 12:09 Re: pg_dumpall in crontab doesn't work Guthrie, John <JGuthrie@air.org>
  2002-07-02 13:45 ` Re: pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
@ 2002-07-02 15:38   ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Bruce Momjian @ 2002-07-02 15:38 UTC (permalink / raw)
  To: Werner Modenbach <modenbach@alc.de>; +Cc: pgsql-admin

Werner Modenbach wrote:
> Guthrie, John wrote:
> 
> > keep in mind that cronjobs don't get your login environment, so things 
> that
> > work in interactive mode often fail in cron unless you make sure to set up
> > the environment there too.
> > 
> Thanks John,
> 
> actually I didn't know that :-(
> In the meantime I added the "</dev/null" as proposed by Tom and it works 
> fine now :-))
> Seems like pg_dump needs it. Maybe this can be improved in future?

Is there a password involved in any of the databases?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026





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

* Re: pg_dumpall in crontab doesn't work
  2002-07-02 12:09 Re: pg_dumpall in crontab doesn't work Guthrie, John <JGuthrie@air.org>
@ 2002-07-02 14:13 ` Kevin Brannen <kevinb@nurseamerica.net>
  1 sibling, 0 replies; 8+ messages in thread

From: Kevin Brannen @ 2002-07-02 14:13 UTC (permalink / raw)
  To: pgsql-admin

Guthrie, John wrote:
> keep in mind that cronjobs don't get your login environment, so things that
> work in interactive mode often fail in cron unless you make sure to set up
> the environment there too.

That is very important to remember!  First try adding "< /dev/null" to 
the command.  If that doesn't work, you can also try adding ". 
$HOME/.profile ; " to the command.

HTH,
Kevin

>>>05 22 *  *  1-5 postgres /usr/bin/pg_dumpall -D > 
>>>/disks/postgres/db.pg_dumpall






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


end of thread, other threads:[~2002-07-02 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-02 06:47 pg_dumpall in crontab doesn't work Werner Modenbach <modenbach@alc.de>
2002-07-02 07:39 ` Nils Höglund <nils@naqua.se>
2002-07-02 07:50   ` Werner Modenbach <modenbach@alc.de>
2002-07-02 13:32     ` Tom Lane <tgl@sss.pgh.pa.us>
2002-07-02 12:09 Re: pg_dumpall in crontab doesn't work Guthrie, John <JGuthrie@air.org>
2002-07-02 13:45 ` Werner Modenbach <modenbach@alc.de>
2002-07-02 15:38   ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-07-02 14:13 ` Kevin Brannen <kevinb@nurseamerica.net>

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