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

Re: QUERY A PSQL DB USING CRONTAB

From: Sigrid Meneses <sigridmeneses(at)gmail(dot)com>
To: olly(at)lfix(dot)co(dot)uk
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: QUERY A PSQL DB USING CRONTAB
Date: 2005-09-23 04:47:59
Message-ID: b6297507050922214741512b91@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi Oliver thanks for your help, i tried with your option, but it didnt
works, so i got the logs, and found that the problem was: the crontab take
for defauklt a logname, so when it want to acces to the DB it havent access.
So when we define the user to access the crontab works fine
example
psql -d databasename -U postgress -c "command"

 2005/9/21, Oliver Elphick <olly(at)lfix(dot)co(dot)uk>:
>
> On Wed, 2005-09-21 at 06:20 -0500, Sigrid Meneses wrote:
> > ... when i add mi script to the crontab, it genrates a file with 0
> > Kb , i dont know why can you help me?
> >
> > FECH=`/bin/date +%Y%m%d`
> > #Se hace la busqueda en la base de datos
> > cd /home/swuser/MDNIMSI
> > psql oampwms_4_1_0_0 -c "select
> > whlr_subscriber_profile.subscriber_id,whlr_mdn.m
> > dn from whlr_subscriber_profile,whlr_mdn where whlr_mdn.id =
> > whlr_subscriber_pro
> > file.mdn;" > pttsubs$FECH.txt
> >
> ...
> >
> > -rw-rw-r-- 1 swuser swuser 0 Sep 16 00:30
> > pttsubs050916.txt
>
> You probably need to set PATH in the script to include where to find
> psql, or else use the full path in the psql command. Cron only has a
> very restricted path set for it.
>
> Oliver Elphick
>
>


--
Sigrid Yahaira Meneses Nielsen
tel cel 044 11 09 94 63

In response to

pgsql-novice by date

Next:From: Gnanavel SDate: 2005-09-23 06:18:11
Subject: Re: Ambiguous error on view
Previous:From: Josh BerkusDate: 2005-09-22 22:08:41
Subject: Re: Formatting results

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