CVS User Account cvsuser
Thu Mar 3 23:46:45 PST 2005
Log Message:
-----------
- Added in ability to query a remote host
- Mention the need to set PGPORT
- Needed to properly quote the cluster namespace
- psql often doesn't live in /usr/local/pgsql/bin; assume it to be in PATH

Modified Files:
--------------
    slony1-engine/tools:
        check_slony_cluster.sh (r1.1 -> r1.2)

-------------- next part --------------
Index: check_slony_cluster.sh
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/check_slony_cluster.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltools/check_slony_cluster.sh -Ltools/check_slony_cluster.sh -u -w -r1.1 -r1.2
--- tools/check_slony_cluster.sh
+++ tools/check_slony_cluster.sh
@@ -11,21 +11,25 @@
 # script requires two parameters:
 # CLUSTERNAME - name of slon cluster to be checked
 # DBNAME - name of master database
+# DBHOST - host name of master database
+#
+# It also depends on PGPORT being set to the appropriate port
 #
 # Author:  John Sidney-Woollett
 # Created: 26-Feb-2005
 # Copyright 2005
 
 # check parameters are valid
-if [[ $# -ne 2 ]]
+if [[ $# -ne 3 ]]
 then
-   echo "Invalid parameters need CLUSTERNAME DBNAME"
+   echo "Invalid parameters need CLUSTERNAME DBNAME DBHOST"
    exit 2
 fi
 
 # assign parameters
 CLUSTERNAME=$1
 DBNAME=$2
+DBHOST=$3
 
 # setup the query to check the replication status
 SQL="select case
@@ -35,16 +39,16 @@
 from (
 -- determine total active receivers
 select (select count(distinct sub_receiver)
-     from _$CLUSTERNAME.sl_subscribe
+     from \"_$CLUSTERNAME\".sl_subscribe
      where sub_active = true) as ttlcount,
 (
 -- determine active nodes syncing within 10 seconds
   select count(*) from (
    select st_received, st_last_received_ts - st_last_event_ts as cfmdelay
-   from _$CLUSTERNAME.sl_status
+   from \"_$CLUSTERNAME\".sl_status
    where st_received in (
      select distinct sub_receiver
-     from _$CLUSTERNAME.sl_subscribe
+     from \"_$CLUSTERNAME\".sl_subscribe
      where sub_active = true
    )
 ) as t1
@@ -52,8 +56,7 @@
 ) as t2"
 
 # query the master database
-CHECK=`/usr/local/pgsql/bin/psql -c "$SQL" --tuples-only -U postgres 
-$DBNAME`
+CHECK=`psql -c "$SQL" --tuples-only -U postgres -h $DBHOST $DBNAME`
 
 if [ ! -n "$CHECK" ]
 then


More information about the Slony1-commit mailing list