[RndTbl] Scripting question

Kevin McGregor kmcgregor at shaw.ca
Tue Jan 30 14:59:35 CST 2007


I have this script:
#!/bin/bash

if [ -e /var/run/pgsql.pipe ]; then
        while [ -e /var/run/pgsql.pipe ]
        do
                psql -q -h padsysdb -U sysloguser syslog </var/run/pgsql.pipe
        done
fi

...running on a Ubuntu Linux server. It's clearly very simple; it just keeps checking the named pipe /var/run/pgsql.pipe and sending the contents to the psql command, which interprets the input as a SQL command and executes it accordingly.

My question is, given that I want this loop to execute (a) from server startup (b) indefinitely and without interruption, how do I reasonably ensure (a) and (b)?

More specifically, where do I stick this (or an equivalent) in the startup scripts on Ubuntu, and is there a good automated way to make sure it keeps going? I really don't want to lose any of my database input. It's a fairly critical system, and I'd like to make this pretty robust.

Kevin


More information about the Roundtable mailing list