pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Call a external app on postgreSQL start-up (windows)
3+ messages / 2 participants
[nested] [flat]

* Call a external app on postgreSQL start-up (windows)
@ 2011-12-27 11:45 Maurício Cruz <cruz@sygecom.com.br>
  2011-12-27 12:14 ` Re: Call a external app on postgreSQL start-up (windows) Filip Rembiałkowski <plk.zuber@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Maurício Cruz @ 2011-12-27 11:45 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

I need to execute some rotines on windows every time that postgreSQL is 
start at the server machine,
I was thinking to create a PL/PGSQL to call this executable, or 
something like...

Does any one, have done something like this ? or have any idea ?



Thanks everyone!





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Call a external app on postgreSQL start-up (windows)
  2011-12-27 11:45 Call a external app on postgreSQL start-up (windows) Maurício Cruz <cruz@sygecom.com.br>
@ 2011-12-27 12:14 ` Filip Rembiałkowski <plk.zuber@gmail.com>
  2011-12-27 13:26   ` Re: Call a external app on postgreSQL start-up (windows) Filip Rembiałkowski <plk.zuber@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Filip Rembiałkowski @ 2011-12-27 12:14 UTC (permalink / raw)
  To: Maurício Cruz <cruz@sygecom.com.br>; +Cc: pgsql-sql

2011/12/27 Maurício Cruz <cruz@sygecom.com.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Call a external app on postgreSQL start-up (windows)
  2011-12-27 11:45 Call a external app on postgreSQL start-up (windows) Maurício Cruz <cruz@sygecom.com.br>
  2011-12-27 12:14 ` Re: Call a external app on postgreSQL start-up (windows) Filip Rembiałkowski <plk.zuber@gmail.com>
@ 2011-12-27 13:26   ` Filip Rembiałkowski <plk.zuber@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Filip Rembiałkowski @ 2011-12-27 13:26 UTC (permalink / raw)
  To: Maurício Cruz <cruz@sygecom.com.br>; +Cc: pgsql-sql

2011/12/27 Maurício Cruz <cruz@sygecom.com.br>:
>
> I need to execute it after the postgreSQL started service.

OK, so the method I described should be good for you.
The script could be put in Task Scheduler every 15 minutes, or minimal
delay that is acceptable.
It can be written in windos batch language, or Perl, or Python, or whatever...



please CC the list when replying ( use "reply to all" )



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-12-27 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-27 11:45 Call a external app on postgreSQL start-up (windows) Maurício Cruz <cruz@sygecom.com.br>
2011-12-27 12:14 ` Filip Rembiałkowski <plk.zuber@gmail.com>
2011-12-27 13:26   ` Filip Rembiałkowski <plk.zuber@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox