David Busby wrote:
List,
    I've got a PHP script on a web site that allows for insertion of data
into my PG database.  After data is inserted I need to have a PERL script
executed that will message many other hosts (sort of like replication).  The
PERL script can take a few minutes to execute.  How can I have the PHP or PG
execute this script, but not wait for its completion?  I can't have the PHP
script lag for 2 minutes, how would I make a trigger in PG fire off a PERl
script for every insert?
You could have the PHP script setup an at job to run the perl script in a couple of minutes. The 'at' command will exit quickly and atd will run the perl script when the time comes.

This is a kludge and may not scale well. A database trigger would be the best way to go, but I don't know if you can setup a trigger to run as a background task, disconnected from the current connection/query.

You could add a column to the database that records the time when a notification was sent out. Then a perl script, running under cron, could periodically check the database, send notifications, and update the database with the notification timestamp.


Tony
--
Anthony E. Greene <mailto:[EMAIL PROTECTED]%3E>
OpenPGP Key: 0x6C94239D/
AOL/Yahoo Chat: TonyG05 HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation. <http://www.linux.org/>



--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list


Reply via email to