pgear is intended to simplify the use of PostgreSQL notification events. It listens for an event and responds to each occurrence of the event by performing an action. The action consists of running a command with the function system(3) or of running SQL, at your option. pgear is similar to pgnotifyd but offers a few more features.

Possible use cases -

Example

pgear --verbose --connect="inventory" --run="reorder-understocked" lowstock
tells pgear to connect to the inventory database and listen for the lowstock event. In response, pgear runs the command reorder-understocked.

The value of the --connect option is the name of a service in the PostgreSQL connection service file, avoiding the plethora of connection options that would otherwise be required.

For a closer look

An html-ized man page is here.

pgear is written in C and built with the GNU autotools. The license is GPLv3+.

You're welcome to take a closer look by following either or both of these links:

pgear-0.2.tar.gz Download this to take a look at the source and try out a build in your environment. You'll need a C compiler and the PostgreSQL libpq library and header files installed, but you don't need the autotools.
pgear source The 'pristine' source code; to use it you'll need git and the usual build tools plus autoconf and automake installed on your computer.

I've built and tested pgear on Debian 'squeeze' (i386 and amd64, PostgreSQL 8.4) and on OpenBSD 4.8 (i386, PostgreSQL 9.0). Your comments are welcome at webmaster@acrasis.net.

Words

Pictures

Updated 2010-11-27 01:24 GMT