am  22.09.2005, um 15:55:53 +0200 mailte "Michael Höller" folgendes:
> 
> 
> Hello,
> 
> I like to automate a daily check and like to run select statement via
> cron but this seems to be more tricky than I thought....
> 
> I tried the following:
> su postgres -c "select count(*) from TABLE where xxxxxx;"

- run the cron direcly as postgres
- echo "select foo from bar" | psql ...


or:

write your sql-query i a file and "psql -f file"

> 
> I have the probelm that I am allways asked for the password - I did not
> find a way how to pass the password. 

put it in the ~/.psqlrc


> 
> Also I like to direct the result to a file, I assume I can do this via >

yes, this is possible.


Regards, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to