[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Linux-cluster] determine active or passive node



I decided to query the cluster suite directly:

#!/bin/bash

HOSTNAME=`hostname`
SERVICE="db2"
CLUSTAT=`/usr/sbin/clustat -s ${SERVICE}|tail -n1`
# Should return: #db2 your-hostname started
if [[ ${CLUSTAT} =~
   ${SERVICE}[[:blank:]]+${HOSTNAME}[[:blank:]]+started ]] ; then
   exit 0;
fi

# Else node is not active.
exit 255

--
Neil Watson             | Debian Linux
System Administrator    | Uptime 38 days
http://watson-wilson.ca


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]