Chris Browne cbbrowne at lists.slony.info
Mon Jul 7 14:16:05 PDT 2008
Update of /home/cvsd/slony1/slony1-engine/tools
In directory main.slony.info:/tmp/cvs-serv20384/tools

Modified Files:
	check_slon.sh check_slony_cluster.sh duplicate-node.sh 
	launch_clusters.sh mkslonconf.sh pull-gborg-mail.sh 
	release_checklist.sh search-logs.sh 
Log Message:
Fix various bash-isms; nonportable constructs that made their way into
sundry shell scripts.  Per bug #54, reported by Peter Eisentraut.


Index: duplicate-node.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/duplicate-node.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** duplicate-node.sh	24 Sep 2007 21:07:45 -0000	1.1
--- duplicate-node.sh	7 Jul 2008 21:16:03 -0000	1.2
***************
*** 198,202 ****
  QUERY="select count(1)=sum(case when set_origin = \"_${SCLUSTER}\".getlocalnodeid('_${SCLUSTER}') then 1 else 0 end) from \"_${SCLUSTER}\".sl_set;"
  ORIGINP=`psql -At ${ORIGINPARMS} -c "${QUERY}"`
! if [[ x${ORIGINP} == "xt" ]] ; then
      echo "Node: ${HOSTORIGIN}/${PORTORIGIN}/${DATABASEORIGIN} is an origin node - OK"
  else
--- 198,202 ----
  QUERY="select count(1)=sum(case when set_origin = \"_${SCLUSTER}\".getlocalnodeid('_${SCLUSTER}') then 1 else 0 end) from \"_${SCLUSTER}\".sl_set;"
  ORIGINP=`psql -At ${ORIGINPARMS} -c "${QUERY}"`
! if [ x${ORIGINP} = "xt" ] ; then
      echo "Node: ${HOSTORIGIN}/${PORTORIGIN}/${DATABASEORIGIN} is an origin node - OK"
  else
***************
*** 210,214 ****
  
  PROVIDERP=`psql -At ${PROVIDERPARMS} -c "${QUERY}"`
! if [[ x${PROVIDERP} == "xt" ]] ; then
      echo "Node: ${HOSTDUP}/${PORTDUP}/${DATABASEDUP} seems like a suitable provider - OK"
  else
--- 210,214 ----
  
  PROVIDERP=`psql -At ${PROVIDERPARMS} -c "${QUERY}"`
! if [ x${PROVIDERP} = "xt" ] ; then
      echo "Node: ${HOSTDUP}/${PORTDUP}/${DATABASEDUP} seems like a suitable provider - OK"
  else
***************
*** 255,257 ****
  
  echo "Scripts to set up duplicate node have been set up in ${mktmp}"
! echo "Please review them before running them."
\ No newline at end of file
--- 255,257 ----
  
  echo "Scripts to set up duplicate node have been set up in ${mktmp}"
! echo "Please review them before running them."

Index: release_checklist.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/release_checklist.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** release_checklist.sh	8 Jan 2007 17:42:17 -0000	1.3
--- release_checklist.sh	7 Jul 2008 21:16:03 -0000	1.4
***************
*** 18,22 ****
  VERCOMMA="${MAJOR},${MINOR},${PATCHLEVEL}"
  VERUNDERSCORE="${MAJOR}_${MINOR}_${PATCHLEVEL}"
! if [[ `egrep "#define SLONY_I_VERSION_STRING_DEC ${VERCOMMA}\$" config.h.in` ]]; then
     echo "SLONY_I_VERSION_STRING_DEC matches"
  else
--- 18,22 ----
  VERCOMMA="${MAJOR},${MINOR},${PATCHLEVEL}"
  VERUNDERSCORE="${MAJOR}_${MINOR}_${PATCHLEVEL}"
! if egrep "#define SLONY_I_VERSION_STRING_DEC ${VERCOMMA}\$" config.h.in >/dev/null 2>&1; then
     echo "SLONY_I_VERSION_STRING_DEC matches"
  else
***************
*** 26,30 ****
  
  echo "Verifying configure..."
! if [[ `egrep "^PACKAGE_VERSION='${VERDOTTED}'\$" configure` ]]; then
     echo "configure PACKAGE_VERSION matches ${VERDOTTED}"
  else
--- 26,30 ----
  
  echo "Verifying configure..."
! if egrep "^PACKAGE_VERSION='${VERDOTTED}'\$" configure >/dev/null 2>&1; then
     echo "configure PACKAGE_VERSION matches ${VERDOTTED}"
  else
***************
*** 33,37 ****
  fi
  
! if [[ `egrep "^PACKAGE_STRING='postgresql-slony1-engine ${VERDOTTED}'\$" configure` ]]; then
     echo "PACKAGE_STRING in configure matches ${VERDOTTED}"
  else
--- 33,37 ----
  fi
  
! if egrep "^PACKAGE_STRING='postgresql-slony1-engine ${VERDOTTED}'\$" configure >/dev/null 2>&1; then
     echo "PACKAGE_STRING in configure matches ${VERDOTTED}"
  else
***************
*** 44,48 ****
      FLIST="${FLIST} $file"
  done
! if [[ x = x"$FLIST" ]]; then
      echo "autoconf has probably been run lately..."
  else
--- 44,48 ----
      FLIST="${FLIST} $file"
  done
! if [ x = x"$FLIST" ]; then
      echo "autoconf has probably been run lately..."
  else
***************
*** 53,57 ****
  STOREDPROCVERS=`awk  -f tools/awk-for-stored-proc-vers.awk  src/backend/slony1_funcs.sql`
  
! if [[ x"$STOREDPROCVERS" = x"$VERDOTTED" ]]; then
     OK=1
     echo "Stored proc version numbers match ${VERDOTTED}"
--- 53,57 ----
  STOREDPROCVERS=`awk  -f tools/awk-for-stored-proc-vers.awk  src/backend/slony1_funcs.sql`
  
! if [ x"$STOREDPROCVERS" = x"$VERDOTTED" ]; then
     OK=1
     echo "Stored proc version numbers match ${VERDOTTED}"

Index: pull-gborg-mail.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/pull-gborg-mail.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pull-gborg-mail.sh	7 Sep 2006 16:27:28 -0000	1.1
--- pull-gborg-mail.sh	7 Jul 2008 21:16:03 -0000	1.2
***************
*** 17,21 ****
  ARG=$1
  
! if [[ x$ARG == "xINIT" ]] ; then
     for year in 2004 2005 2006; do
       for month in January February March April May June July August September October November December; do
--- 17,21 ----
  ARG=$1
  
! if [ x$ARG = "xINIT" ] ; then
     for year in 2004 2005 2006; do
       for month in January February March April May June July August September October November December; do
***************
*** 37,39 ****
  	done
      done
! fi
\ No newline at end of file
--- 37,39 ----
  	done
      done
! fi

Index: launch_clusters.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/launch_clusters.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** launch_clusters.sh	4 Oct 2007 15:30:34 -0000	1.5
--- launch_clusters.sh	7 Jul 2008 21:16:03 -0000	1.6
***************
*** 61,65 ****
      LOGHOME=$3
  
!     if [[ -e $CONFIGPATH/conf/node${NODENUM}.conf ]] ; then
  	SLONCONF="$CONFIGPATH/conf/node${NODENUM}.conf"
  	SLONPIDFILE=`grep "^ *pid_file=" $SLONCONF | cut -d "=" -f 2 | cut -d "#" -f 1 | cut -d " " -f 1 | cut -d "'" -f 2`
--- 61,65 ----
      LOGHOME=$3
  
!     if [ -e $CONFIGPATH/conf/node${NODENUM}.conf ]; then
  	SLONCONF="$CONFIGPATH/conf/node${NODENUM}.conf"
  	SLONPIDFILE=`grep "^ *pid_file=" $SLONCONF | cut -d "=" -f 2 | cut -d "#" -f 1 | cut -d " " -f 1 | cut -d "'" -f 2`
***************
*** 85,93 ****
  	      ;;
      esac
!     if [[ -e $SLONPIDFILE ]] ; then
  	SLONPID=`cat $SLONPIDFILE`
  
  	FINDIT=`ps -p ${SLONPID} -o ${PSCOMM}= | grep slon`
! 	if [[ -z $FINDIT ]]; then
          # Need to restart slon
  	    log_action "slon died for config $CONFIGPATH/conf/node${NODENUM}.conf"
--- 85,93 ----
  	      ;;
      esac
!     if [ -e $SLONPIDFILE ] ; then
  	SLONPID=`cat $SLONPIDFILE`
  
  	FINDIT=`ps -p ${SLONPID} -o ${PSCOMM}= | grep slon`
! 	if [ -z $FINDIT ]; then
          # Need to restart slon
  	    log_action "slon died for config $CONFIGPATH/conf/node${NODENUM}.conf"
***************
*** 98,102 ****
      else
          ${BPS} auxww | egrep "[s]lon -f $CONFIGPATH/conf/node${NODENUM}.conf" > /dev/null
! 	if [[ $? -eq 0 ]] ; then 	
              echo "Slon already running - but PID marked dead"
  	else
--- 98,102 ----
      else
          ${BPS} auxww | egrep "[s]lon -f $CONFIGPATH/conf/node${NODENUM}.conf" > /dev/null
! 	if [ $? -eq 0 ] ; then 	
              echo "Slon already running - but PID marked dead"
  	else

Index: mkslonconf.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/mkslonconf.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** mkslonconf.sh	2 Jan 2007 20:17:34 -0000	1.3
--- mkslonconf.sh	7 Jul 2008 21:16:03 -0000	1.4
***************
*** 157,161 ****
      echo "Generating slon conf file $conffile"
  
!     if [[ -e $conffile ]] ; then
  	echo "config file $conffile already exists."
  	echo "Do you want to (Overwrite) it or (Skip) it (Anything else aborts) [Overwrite|Skip]?"
--- 157,161 ----
      echo "Generating slon conf file $conffile"
  
!     if [ -e $conffile ] ; then
  	echo "config file $conffile already exists."
  	echo "Do you want to (Overwrite) it or (Skip) it (Anything else aborts) [Overwrite|Skip]?"

Index: check_slon.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/check_slon.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** check_slon.sh	21 Jun 2006 17:41:19 -0000	1.3
--- check_slon.sh	7 Jul 2008 21:16:03 -0000	1.4
***************
*** 21,25 ****
  
  # check parameters are valid
! if [[ $# -lt 2 || $# -gt 3 ]]
  then
     echo "Invalid parameters need CLUSTERNAME DBNAME DBHOST [LOGFILE]"
--- 21,25 ----
  
  # check parameters are valid
! if [ $# -lt 2 ] || [ $# -gt 3 ]
  then
     echo "Invalid parameters need CLUSTERNAME DBNAME DBHOST [LOGFILE]"

Index: check_slony_cluster.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/check_slony_cluster.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** check_slony_cluster.sh	22 Aug 2007 17:50:23 -0000	1.4
--- check_slony_cluster.sh	7 Jul 2008 21:16:03 -0000	1.5
***************
*** 71,75 ****
  STATUS=`echo $CHECK | awk '{print $1}'`
  NODESOK=`echo $CHECK | awk '{print $3}'`
! if [[ $STATUS = "OK"  && $NODESOK != "0" ]]
  then
     exit 0
--- 71,75 ----
  STATUS=`echo $CHECK | awk '{print $1}'`
  NODESOK=`echo $CHECK | awk '{print $3}'`
! if [ $STATUS = "OK" ] && [ $NODESOK != "0" ]
  then
     exit 0

Index: search-logs.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/search-logs.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** search-logs.sh	16 Nov 2006 20:01:01 -0000	1.2
--- search-logs.sh	7 Jul 2008 21:16:03 -0000	1.3
***************
*** 11,15 ****
  EXCLUSIONS="No Exclusions Known"
  
! if [[ -z $LOGTIMESTAMP ]] ; then
      HRRE=`date -d "1 hour ago" +"%Y-%m-%d %H:[0-9][0-9]:[0-9][0-9] ${TZ}"`
  else
--- 11,15 ----
  EXCLUSIONS="No Exclusions Known"
  
! if [ -z $LOGTIMESTAMP ] ; then
      HRRE=`date -d "1 hour ago" +"%Y-%m-%d %H:[0-9][0-9]:[0-9][0-9] ${TZ}"`
  else
***************
*** 20,24 ****
      egrep "${HRRE} (ERROR|FATAL)" $log | egrep -v "${EXCLUSIONS}" > /tmp/slony-errors.$$ 
  
!     if [[ -s /tmp/slony-errors.$$ ]] ; then 
          echo "
  Errors in log ${log} 
--- 20,24 ----
      egrep "${HRRE} (ERROR|FATAL)" $log | egrep -v "${EXCLUSIONS}" > /tmp/slony-errors.$$ 
  
!     if [ -s /tmp/slony-errors.$$ ] ; then 
          echo "
  Errors in log ${log} 
***************
*** 28,33 ****
  done 
   
! if [[ -s /tmp/slony-summary.$$ ]] ; then 
!     if [[ -z $LOGRECIPIENT ]] ; then
  	echo "Errors found!"
  	cat /tmp/slony-summary.$$  
--- 28,33 ----
  done 
   
! if [ -s /tmp/slony-summary.$$ ] ; then 
!     if [ -z $LOGRECIPIENT ] ; then
  	echo "Errors found!"
  	cat /tmp/slony-summary.$$  



More information about the Slony1-commit mailing list