From: | Jesse Burkhardt <jesse(at)skybuilders(dot)com> |
---|---|
To: | "'pgsql-admin(at)postgresql(dot)org'" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Automated backup problems - pg_dump |
Date: | 2003-08-24 22:46:38 |
Message-ID: | 3F49404E.5000301@skybuilders.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
I am sure many of you have encountered the problems I am experiencing
with automating the pg_dump command from a cron. The problem arises from
a failure of this command to use the environmental variable,
PG_PASSWORD. (PGUSER, on the other hand, is picked up during command
execution.) The cron seems to fail completely when crontabbed as the
PGSQL superuser, postgres. I do, however, get partial execution when I
su to the user postgres from a cron crontabbed as root. Let me layout
some relevant info:
root orginated cron:
30 * * * * su - postgres --command="cd /var/lib/pgsql/skybuilders;
/var/lib/pgsql/skybuilders/dbbackup.pl; echo `date` > timeRun.txt"
skybuilders is a directory where I copy and dump PostgreSQL files and
DBs to be picked up by an rsync cron on an archiving machine.
dbbackup.pl is a perl script that generates a bash shell. I will excerpt
the pertinant (failing) section of the generated script
(dbbackupGenerated.sh):
PGUSER=someuser
export PGUSER
PG_PASSWORD=somepassword
export PG_PASSWORD
pg_dump -o somedb > /var/lib/pgsql/skybuilders/dbbackup/somedb.dump
When I run the script from the command line, after having su'ed into the
postgres account, this script stops at the pg_dump line waiting for a
password.
Finally I will excerpt some of the final lines of my pg_hba.conf file:
# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE
AUTH_ARGUMENT
#local all trust
#host all 127.0.0.1 255.255.255.255 trust
# Using sockets credentials for improved security. Not available everywhere,
# but works on Linux, *BSD (and probably some others)
#local all ident sameuser
### --> Added by JSB <--
local skyTemplate md5
local sameuser md5
local all md5 admins
# use following line to perform commands as postgres without password
challenge
# local all trust
host all 10.10.40.25 255.255.255.255 md5
I understand were I to change the AUTH_TYPE setting from "md5" to
"trust" the password challenge emanating from the pg_dump command will
go away. However, I wish to maintain the use of md5 authentication.
Ideas anybody?
--
Jesse Burkhardt
jesse(at)skybuilders(dot)com (w) 617-876-5680
goose(at)aerogoose(dot)com (h) 617-354-5523
From | Date | Subject | |
---|---|---|---|
Next Message | Curt Sampson | 2003-08-25 01:28:53 | Re: Disk Utilization Increases And Time for Vacuum Increases. |
Previous Message | Serguei Mokhov | 2003-08-24 03:00:21 | Re: undefined reference to `_libintl_gettext' |