[CentOS] Cron and Cluster

Wed Mar 31 05:08:17 UTC 2010
Ian Forde <ianforde at gmail.com>

On Wed, 2010-03-31 at 00:33 +0000, Joseph L. Casale wrote:
> >What kind of cluster? the term cluster can mean almost
> >anything these days.
> 
> Sorry, my bad. RHCS

I can tell you how I did it for a 2-node heartbeat cluster.  I enabled
the cron jobs on both servers, and had the following snippet at the top
of each script:

[ ! -f /usr/local/etc/db_inc.sh ] && exit 3
. /usr/local/etc/db_inc.sh
getactivestatus

if [ "${activestate}" = "no" ]; then
	exit 0
fi

So in the file /usr/local/etc/db_inc.sh, I would define a function that
would return whether or not I was the active node.  An example of this
would be:

getactivestatus() {
	if [ `cl_status rscstatus` = "all" ]; then
		activestate="yes"
	else
		activestate="no"
	fi
}

You'll need a command that determines the active/passive status for RHCS
to put into the getactivestatus() function, then you should be all
set...

	-I