PDA

View Full Version : cron jobs for views in postgresql


Montfort
03-20-02, 14:05
I need to know how to get the results of a query into text file,on regular basis using a cron scrpit?

any suggestions?

MaleMan
03-20-02, 21:46
is it possible to use cron for making database backup and vaccum?
can u guys give me some hints and tips... or u can show me the details if u want... :D

uhexo
03-22-02, 21:34
Of couse,

check man crontab, this command line program allows the program schedule task.

Only made a bash script saving the postgres envionment and you can run whatever postgres command.

BTW, if you want to save sql result into text file, you could run something like:
psql mydb <<!
select * from pg_user
! > file.txt 2> error.log
or
echo "select * from pg_user" | psql mydb > file.txt 2> error.log


Salu lulu.







Originally posted by MaleMan
is it possible to use cron for making database backup and vaccum?
can u guys give me some hints and tips... or u can show me the details if u want... :D

MaleMan
03-24-02, 21:39
THANX for the help... :D

Montfort
03-25-02, 00:45
Thanks for the suggestions.....


Montfort.