Re: Call a external app on postgreSQL start-up (windows)

From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: Maurício Cruz <cruz(at)sygecom(dot)com(dot)br>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Call a external app on postgreSQL start-up (windows)
Date: 2011-12-27 12:14:34
Message-ID: CAP_rwwnADUK4oYbtU1VUEcOJ1a1gSBGB4cYn1nmpunVy59XWYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2011/12/27 Maurício Cruz <cruz(at)sygecom(dot)com(dot)br>:
> Hi all,
>
> I need to execute some rotines on windows every time that postgreSQL is
> start at the server machine,

before it's started or just after it's started?

> I was thinking to create a PL/PGSQL to call this executable, or something
> like...
there are no triggers other than INSERT/UPDATE/DELETE yet.

I would rather go and create external script
- read lastruntime from savefile (simple one line text file will do)
- connect to postgres and fetch SELECT now(), pg_postmaster_start_time();
- if "pg_postmaster_start_time" is newer than statefile timestamp,
save "now" to savefile and run the job.

(I looked at PgAgent but from the docs I see it does not yet have
"once per server startup" logic).

>
> Does any one, have done something like this ? or have any idea ?
>
>
>
> Thanks everyone!
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2011-12-27 13:26:38 Re: Call a external app on postgreSQL start-up (windows)
Previous Message Maurício Cruz 2011-12-27 11:45:06 Call a external app on postgreSQL start-up (windows)