Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group