Does this program already exist?
$ listen-and-do --database=foo --listen-for="somenotification" \
--then-do="some-script"
It will daemonize itself, issue a 'LISTEN somenotification' on the
database foo, and on each NOTIFY will run some-script.
Thanks
--
KM