Cron and shell script as user postgres to run sql command

From: Josep Sànchez Mesegué <papapep(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Cron and shell script as user postgres to run sql command
Date: 2008-05-26 21:18:21
Message-ID: e74c0cea0805261418y6b01cfach45668c8fc12e126e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I've been trying to run a shell script that, among other things, invokes
some sql scripts as user postgres with cron. First, I found that as cron
doesn't inherit the environment variables that are defined in the
script, i.e. the path to some of the scripts, I had to declare them
globally. But when I've done this, it seems that cron is not able to run
this script as postgres user. (all of this under Debian Etch)
In every forum or webpage where I look at, it seems that it has to be
run as root to work....but how can it work running it as root if the
user to run the sql scripts and access the database has to be
postgres??

What am I missing?

Thanks in advance for your help.

--
Josep Sànchez
[papapep]
-------------------------------------------------
http://extralinux.net
-------------------------------------------------

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Phillip Smith 2008-05-27 00:17:55 Re: Cron and shell script as user postgres to run sql command
Previous Message Tom Lane 2008-05-25 23:46:33 Re: Unable to recover tables