Cron and shell script as user postgres to run sql command - Mailing list pgsql-novice

From Josep Sànchez Mesegué
Subject Cron and shell script as user postgres to run sql command
Date
Msg-id e74c0cea0805261418y6b01cfach45668c8fc12e126e@mail.gmail.com
Whole thread Raw
Responses Re: Cron and shell script as user postgres to run sql command  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
List 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
-------------------------------------------------

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unable to recover tables
Next
From: "Phillip Smith"
Date:
Subject: Re: Cron and shell script as user postgres to run sql command