Re: Perl and pg_dump

From: "D(dot) Duccini" <duccini(at)backpack(dot)com>
To: James Hall <James(dot)Hall(at)RadioShack(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Perl and pg_dump
Date: 2000-07-10 21:58:48
Message-ID: Pine.GSO.4.03.10007101658090.17874-100000@ra.bpsi.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


easy, just "su -" into that account, and then plug in your crontab entry

it will then run with the effective permissions of whatever user is setup

On Mon, 10 Jul 2000, James Hall wrote:

> This may not be the right place to post this question, but I had to start
> somewhere.
>
> I have a small perl script that is supposed to run pg_dump daily to backup
> databases.
> The script is called via the cron on a Redhat 6.1 system with PostgreSQL
> 6.5.
>
> The error that I receive when cron attempts to run the script is:
>
> Connection to database 'template1' failed.
> FATAL 1: SetUserId: user 'root' is not in 'pg_shadow'
>
> I know root isn't in pg_shadow, and I don't want it there (I _do_ know
> better than to do things as root ;)).
>
> How can I tell either Linux, PostgreSQL or the script to use another user
> (Postgres?) to run the script?
>
> A copy of the script is below.
>
> TIA-
> Jim
> --------------------------------------------
> #!/bin/sh
>
> PSQL=/usr/bin/psql
> DUMP=/usr/bin/pg_dump
> PREFIX=`date +%j`
> BACKUP_DIR=/data/pgsql/data
>
> Databases=`$PSQL -tq -d template1 -c "select datname from pg_database"`
> renice 20 $$
>
> echo Backup started ...
> for db in `echo $Databases`
> do
>
> echo "time: `date +%H%M%S` - Backup of $db in progress ..."
> $DUMP -D $db > $BACKUP_DIR/$PREFIX.$db
> echo "time: `date +%H%M%S` - Backup of $db finished ..."
> done
> echo Backup finished
> ----------------------------------------------
>

-----------------------------------------------------------------------------
david(at)backpack(dot)com BackPack Software, Inc. www.backpack.com
+1 651.645.7550 voice "Life is an Adventure.
+1 651.645.9798 fax Don't forget your BackPack!"
-----------------------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Maney 2000-07-10 22:08:00 Re: Perl and pg_dump
Previous Message James Hall 2000-07-10 21:54:43 Perl and pg_dump