Re: Schedule Jobs in Postgres

From: <mallah(at)trade-india(dot)com>
To: <scott(dot)marlowe(at)ihs(dot)com>
Cc: <madhavi(at)zoniac(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schedule Jobs in Postgres
Date: 2003-05-14 16:21:28
Message-ID: 1057.219.65.236.175.1052929288.squirrel@mail.trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

unless madhavi is running postgres in windoze.
cron is a reliable way of executing psotgresql tasks.

Some Tips:

1. I find it helpful to put the SQL related crons under
a dedicated user , so that i dont have to hunt around
to get the list of all scheduled SQLs.

2. If sql batch is to be run its better to use a .sql script
with all the SQL statements in it and enclosed in
a BEGIN WORK ; <SQLS> ; COMMIT;

3. MAILTO env variable shud be set to get error reports
on SQL activity.

4. -q or -e option can be with psql depending on need.

Regds
Rajesh Kumar Mallah.

> On Wed, 14 May 2003, Madhavi Daroor wrote:
>
>> Hi all,
>> My company ZONIAC INDIA PVT LTD is extensively using Pstgres as the
>> database for their product. And right now I'm in need to schedule a job that inserts a record
>> into a table based on the value of a field in another table. How can I do this? Please let me
>> know as soon as possible. It is URGENT!!!.
>>
>> I'm not talking about triggers because no other event is triggering this particular job. This
>> job must be scheduled so that as soon as the difference between the value in a field and a
>> particular date is reduced to 1 day, a record is inserted in another table.
>
> You're likely gonna need to write a cron job that runs when the date changes, or whatnot.
> Then, you can run it with something like:
>
> psql dbname -c -- 'query goes here'
>
> Basically, making things happen on at a certain time is cron's job.
>
>
> ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off
> all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

-----------------------------------------
Get your free web based email at trade-india.com.
"India's Leading B2B eMarketplace.!"
http://www.trade-india.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2003-05-14 16:33:23 Re: COPY versus INSERT
Previous Message Doug McNaught 2003-05-14 16:16:24 Re: Questions regarding stored procedures