Re: pg_dump shell script with ~/.pgpass

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: pg_dump shell script with ~/.pgpass
Дата
Msg-id 41F92356.5040906@archonet.com
обсуждение исходный текст
Ответ на Re: pg_dump shell script with ~/.pgpass  (MargaretGillon@chromalloy.com)
Ответы Re: pg_dump shell script with ~/.pgpass  (Frank Miles <fpm@u.washington.edu>)
Список pgsql-general
MargaretGillon@chromalloy.com wrote:
> I posted the message below on 1/15/05 and haven't received a reply yet.
> Should I be asking this question on a different list?

This is probably the right list - your message may have been missed
though, there can be a lot of traffic.
>
> I need to create a shell script for cron.daily to run that will do pg_dump
> for my database. I am using Redhat 9 and Postgresql v7.3.4.  Currently when
> I run the dump manually the command I use is
>
> #pg_dump -u -C -D -f /tmp/owl.sql owl
>
> What should the command look like using ~/.pgpass ?

Well, from cron, I'd add an explicit username "-U username" and then in
your .pgpass add the host/port/db/user/password as described in the
manuals (client interfaces/libc/files).

> My other question... Is cron.daily is being run by root? If so would I need
> to put the .pgpass file in root's home directory?

Yes and yes. Also, make sure you chmod the file as described in the manual.
The alternative would be to set up a crontab for another user, and place
the .pgpass in their home-dir.

> I only have two postgresql users right now, myself and postgres.  On the
> redhat server I have only two users, myself and root, there is no user
> postgres.

Are you sure? There are almost certainly dozens of users in /etc/passwd
and if you installed by RPM then there *will* be a user postgres. That's
not to say you can just login as them though - they might have their
shell disabled.

--
   Richard Huxton
   Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: pg_dump shell script with ~/.pgpass
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: last tuple affected