pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
running psql in a cron job
5+ messages / 3 participants
[nested] [flat]

* running psql in a cron job
@ 2002-08-07 14:51  Wei Weng <wweng@kencast.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Wei Weng @ 2002-08-07 14:51 UTC (permalink / raw)
  To: pgsql-sql

My database has "local all password" as its HBA control.

Is there anyway to manipulate psql so that I can somehow put the
password also inside the command line so that I can run psql in a cron
job? (such as psql -c "VACUUM ANALYZE" -d my_data -U my_user)

Thanks

-- 
Wei Weng
Network Software Engineer
KenCast Inc.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: running psql in a cron job
@ 2002-08-07 15:01  Wei Weng <wweng@kencast.com>
  parent: Wei Weng <wweng@kencast.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Wei Weng @ 2002-08-07 15:01 UTC (permalink / raw)
  To: pgsql-sql

never mind. a quick search in the mailing list archive solved the
problem. :)

Just use PGPASSWORD=my_pass psql -c "VACUUM ANALYZE" -d my_data -U
my_user


On Wed, 2002-08-07 at 10:51, Wei Weng wrote:
> My database has "local all password" as its HBA control.
> 
> Is there anyway to manipulate psql so that I can somehow put the
> password also inside the command line so that I can run psql in a cron
> job? (such as psql -c "VACUUM ANALYZE" -d my_data -U my_user)
> 
> Thanks
> 
> -- 
> Wei Weng
> Network Software Engineer
> KenCast Inc.
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 
-- 
Wei Weng
Network Software Engineer
KenCast Inc.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: running psql in a cron job
@ 2002-08-07 17:07  Wei Weng <wweng@kencast.com>
  parent: Ignacio Coloma <icoloma-lists@iverdino.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Wei Weng @ 2002-08-07 17:07 UTC (permalink / raw)
  To: pgsql-sql

PGPASSWORD=my_pass sets the password to my_pass.

On Wed, 2002-08-07 at 14:02, Ignacio Coloma wrote:
> Maybe I'm a bit lost: if cron is executed as root, then su <user> -c 
> 'command' would work without providing the password?
> 
> I mean, putting the password plain text anywhere doesn't seem that nice 
> idea imho
> 
> Wei Weng wrote:
> 
> >never mind. a quick search in the mailing list archive solved the
> >problem. :)
> >
> >Just use PGPASSWORD=my_pass psql -c "VACUUM ANALYZE" -d my_data -U
> >my_user
> >
> >
> >On Wed, 2002-08-07 at 10:51, Wei Weng wrote:
> >  
> >
> >>My database has "local all password" as its HBA control.
> >>
> >>Is there anyway to manipulate psql so that I can somehow put the
> >>password also inside the command line so that I can run psql in a cron
> >>job? (such as psql -c "VACUUM ANALYZE" -d my_data -U my_user)
> >>
> >>Thanks
> >>
> >>-- 
> >>Wei Weng
> >>Network Software Engineer
> >>KenCast Inc.
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 6: Have you searched our list archives?
> >>
> >>http://archives.postgresql.org
> >>
> >>    
> >>
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 
-- 
Wei Weng
Network Software Engineer
KenCast Inc.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: running psql in a cron job
@ 2002-08-07 18:02  Ignacio Coloma <icoloma-lists@iverdino.com>
  parent: Wei Weng <wweng@kencast.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Ignacio Coloma @ 2002-08-07 18:02 UTC (permalink / raw)
  To: Wei Weng <wweng@kencast.com>; pgsql-sql

Maybe I'm a bit lost: if cron is executed as root, then su <user> -c 
'command' would work without providing the password?

I mean, putting the password plain text anywhere doesn't seem that nice 
idea imho

Wei Weng wrote:

>never mind. a quick search in the mailing list archive solved the
>problem. :)
>
>Just use PGPASSWORD=my_pass psql -c "VACUUM ANALYZE" -d my_data -U
>my_user
>
>
>On Wed, 2002-08-07 at 10:51, Wei Weng wrote:
>  
>
>>My database has "local all password" as its HBA control.
>>
>>Is there anyway to manipulate psql so that I can somehow put the
>>password also inside the command line so that I can run psql in a cron
>>job? (such as psql -c "VACUUM ANALYZE" -d my_data -U my_user)
>>
>>Thanks
>>
>>-- 
>>Wei Weng
>>Network Software Engineer
>>KenCast Inc.
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 6: Have you searched our list archives?
>>
>>http://archives.postgresql.org
>>
>>    
>>





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: running psql in a cron job
@ 2002-08-07 18:54  Ross J. Reedstrom <reedstrm@rice.edu>
  parent: Ignacio Coloma <icoloma-lists@iverdino.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Ross J. Reedstrom @ 2002-08-07 18:54 UTC (permalink / raw)
  To: Ignacio Coloma <icoloma-lists@iverdino.com>; +Cc: Wei Weng <wweng@kencast.com>; pgsql-sql

On Wed, Aug 07, 2002 at 06:02:39PM +0000, Ignacio Coloma wrote:
> Maybe I'm a bit lost: if cron is executed as root, then su <user> -c 
> 'command' would work without providing the password?
> 
> I mean, putting the password plain text anywhere doesn't seem that nice 
> idea imho

It's not the unix 'postgres' user's password: it's the database password
for the DB user - a completely independent user/password pair.

Ross

> 
> Wei Weng wrote:
> 
> >never mind. a quick search in the mailing list archive solved the
> >problem. :)
> >
> >Just use PGPASSWORD=my_pass psql -c "VACUUM ANALYZE" -d my_data -U
> >my_user



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2002-08-07 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-07 14:51 running psql in a cron job Wei Weng <wweng@kencast.com>
2002-08-07 15:01 ` Wei Weng <wweng@kencast.com>
2002-08-07 18:02   ` Ignacio Coloma <icoloma-lists@iverdino.com>
2002-08-07 17:07     ` Wei Weng <wweng@kencast.com>
2002-08-07 18:54     ` Ross J. Reedstrom <reedstrm@rice.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox