Thread: Stored procedure in PostgreSQL
I would like to start stored procedure (function) at specific time and repeate stored procedure every day. Is it posible in PostgreSQl? Thanks.
----- Original Message ----- From: "Robert" <rrozboril@goldmann.sk> > I would like to start stored procedure (function) at specific time and > repeate stored procedure every day. > Is it posible in PostgreSQl? > what about writing a script that will be executed by crond every day? the script should contain something like: su -l postgres -c "psql -d DBNAME -c \"select * from ..... \" " hth, Marin ---- "...what you brought from your past, is of no use in your present. When you must choose a new path, do not bring old experiences with you. Those who strike out afresh, but who attempt to retain a little of the old life, end up torn apart by their own memories. "
On Wed, 2002-03-06 at 10:37, Robert wrote: > I would like to start stored procedure (function) at specific time and > repeate stored procedure every day. > Is it posible in PostgreSQl? How about : "psql -c \"SELECT my_func()\"" in your crontab ? /BL
Le Mercredi 6 Mars 2002 10:37, Robert a écrit : > I would like to start stored procedure (function) at specific time and > repeate stored procedure every day. > Is it posible in PostgreSQl? Run batch scripts (Windows) or cron jobs (Linux) excuting: "psql databasename "SELECT function_foo()" or "psql databasename < filename.sql" Best regards, Jean-Michel POURE
Basically you would use your operating-systems cron (or equivalent) system. 1. Setup a query that executes the function, put it in a file; 2. add something like this to your crontab: 10 03 * * * /path-to-psql/psql < the-file-from-step-1 this would execute your at 10 minutes past 3 (in the morning), every day (*) of every month (*) regardless of the weekday (*). Read up on man crontab for more info. Success, Arian. Robert schreef: > I would like to start stored procedure (function) at specific time and > repeate stored procedure every day. > Is it posible in PostgreSQl? > > Thanks.