Sunday, March 30, 2008

PgAgent - Installation and usage

Prompted by the usual Devshed's post, this time about pgAgent, here I am with a small "tutorial" (or maybe just a small collection of screenshots).
PgAgent is a great little tool, much like SQLServer's SQLAgent or the built in scheduling abilities of Oracle and MySQL (which is a much nicer solution IMHO), what's weak is the installation and the docs, I mean, why the pgAdminIII installer does ask for pgAgent installation and doesn't really install it?
All this just to have a few files placed on my Hd?
So, first of all, pgAdmin guys please add to your installer the ability to actually install pgAgent, or even better have the PostgreSQL guys add it to the main server distribution, where it belongs.

Now for the actual installation let's have a look at the docs, the main steps for installation are (I'm working on Windows):
  1. Database setup
    1. Work within the postgres standard database
    2. Check if pl/pgsql is installed
    3. If not, install it
    4. Connect to the postgres database and run a sql script provided with the installation that creates all required objects, that script is named pgagent.sql and it's kept in the [$Program files]\pgAdmin III\[$version]\Scripts folder
    5. After this, if you connect with pgAdminIII you'll see a new branch in the objects tree, named "Job"
  2. Service installation
    1. The service has to be installed from the command line, like this

C:\Documents and Settings\Paolo>"C:\Programmi\pgAdmin III\1.8\pg
Agent" INSTALL pgAgent -u postgres -p postgres hostaddr= dbname=pgadmin

C:\Documents and Settings\Paolo>
    1. Start the just installed service
BE AWARE OF THE SECURITY RISKS of this kind of installation

No comments: