From e2fb187084da50e01855531622beeacafd1b93e6 Mon Sep 17 00:00:00 2001 From: User tanida Date: Mon, 18 Jun 2007 10:21:09 +0000 Subject: [PATCH] - fix pgpool-ha does not work well with multiple 'logdir' entries, even one of them is commented by #. - Add support for pcp.conf and pool_hba.conf. It means pgpool-ha now works well with pgpool 3.2+ and pgpool-II. - Add configuration parameter -pgpoolconf , path to pgpool.conf. -pbaconf , path to pool_hba.conf. -pcpconf , path to pcp.conf. -logfile , path to debug log output. --- src/pgpool.in | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/src/pgpool.in b/src/pgpool.in index c57df2e..769a543 100755 --- a/src/pgpool.in +++ b/src/pgpool.in @@ -40,14 +40,50 @@ check_pid () { PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH PGP_CONF=`@_PGPOOL_@ -h 2>&1 | grep default | sed -e 's/ config_file default path: //g'` +PATH=/bin:/usr/bin:/sbin:/usr/sbin +export PATH +if [ "x$OCF_RESKEY_pgpoolconf" = 'x' ]; then + PGP_CONF=`@_PGPOOL_@ -h 2>&1 | grep " config_file default" | sed -e 's/ config_file default path: //g'` +else + PGP_CONF=$OCF_RESKEY_pgpoolconf +fi +if [ "x$OCF_RESKEY_pcpconf" = 'x' ]; then + PCP_CONF=`@_PGPOOL_@ -h 2>&1 | grep " pcp_config_file default" | sed -e 's/ pcp_config_file default path: //g'` +else + PCP_CONF=$OCF_RESKEY_pcpconf +fi +if [ "x$OCF_RESKEY_hbaconf" = 'x' ]; then + HBA_CONF=`@_PGPOOL_@ -h 2>&1 | grep " hba_file default" | sed -e 's/ hba_file default path: //g'` +else + HBA_CONF=$OCF_RESKEY_hbaconf +fi +if [ "x$OCF_RESKEY_logfile" != 'x' ]; then + LOGFILE=$OCF_RESKEY_logfile +fi + +echo $PGP_CONF PGPOOL="@_PGPOOL_@ -f $PGP_CONF" PGPOOL_START_ARG="" + +if [ "x$HBA_CONF" != 'x' ];then + PGPOOL="$PGPOOL -a $HBA_CONF" +fi + +if [ "x$PCP_CONF" != 'x' ];then + PGPOOL="$PGPOOL -F $PCP_CONF" +fi + +if [ "x$LOGFILE" != 'x' ];then + PGPOOL="nohup $PGPOOL" + PGPOOL_START_ARG="$PGPOOL_START_ARG -d -n >>$LOGFILE 2>&1 &" +fi + PGPOOL_STOP_ARG=" stop" PGPOOL_FORCE_STOP_ARG=" -m i $PGPOOL_STOP_ARG" PGPOOL_MONITOR=@_PGPOOL_@.monitor PGPOOL_MONITOR_ARGS=--conf=$PGP_CONF localhost >/dev/null 2>&1 -PGPOOL_PID=`grep logdir $PGP_CONF | tr -d "''=" | awk '{print $2."/pgpool.pid"}'` +PGPOOL_PID=`grep -P '^[^#]*logdir' $PGP_CONF | tr -d "''=" | awk '{print $2."/pgpool.pid"}'` # Source function library. . /etc/rc.d/init.d/functions @@ -124,6 +160,35 @@ cat < pgpool server control. + + + Path to pgpool.conf + + pgpool.conf path + + + + + Path to pcp.conf. pgpool-II only. + + pcp.conf + + + + + Path to pool_hba.conf. requires pgpool > 3.2 only. + + pool_hba.conf + + + + + + Path to output logfile . logfile contains debuglog. if this entry is empty , log output is depends on pgpool. + + logfile + + @@ -143,4 +208,5 @@ EOF exit 1 esac -exit 0 + +lexit 0 -- 2.39.5