Re: [OT] Dilemma about OS <-> Postgres interaction - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: [OT] Dilemma about OS <-> Postgres interaction
Date
Msg-id 87f5e880f23f306d6524cd40c621790a@biglumber.com
Whole thread Raw
In response to Re: [OT] Dilemma about OS <-> Postgres interaction  (Rory Campbell-Lange <rory@campbell-lange.net>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> I should have mentioned that we need the messages sent very soon
> after they have landed in the 'inbox'; otherwise cron would
> definitely be the way to go -- including an @reboot line.

Cron will work just fine. Here's how I did it for a project I once
had. Write a perl script that make a connection to the database,
then loops indefinitely, checking the database every X seconds
for new mail to send. When in finds some, it forks a child to handle
it, then goes on listening. Now write a small script that checks if
the first script is still running. If it is, exit silently. If
not, launch a new instance. Add an entry in cron to run the second
script every minute. New mail is sent out instantly, and your script
gets resurrected if killed. You might also look into the daemontools
program, which does something similar.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200406190730

-----BEGIN PGP SIGNATURE-----

iD8DBQFA1CS4vJuQZxSWSsgRArGzAJ0bgwn4RPYCNwz7xxzUE/wU1SOm/QCeMGBu
VyCS3Y4bNO8XySrH6slYsUM=
=O0Eb
-----END PGP SIGNATURE-----



pgsql-general by date:

Previous
From: Tatsuo Ishii
Date:
Subject: pgpool 2.0RC1
Next
From: Kevin Murphy
Date:
Subject: syntax error but command executes anyway?