From: TAKATSUKA Haruka Date: Fri, 11 May 2012 00:34:43 +0000 (+0900) Subject: * Add "pkill -P 1 pgpool" when missing pgpool main process at stop-action X-Git-Tag: PGPOOL_HA_2_0~3 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=7437074186022450ab26a7181fb66bdcee9a5b34;p=pgpoolha.git * Add "pkill -P 1 pgpool" when missing pgpool main process at stop-action * Add OCF_RESKEY_monitor_ip * Fix indent --- diff --git a/ChangeLog b/ChangeLog index afcb2be..6a82dd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012/02/17 + * add "pkill -P 1 pgpool" when missing pgpool main process at stop-action + * add OCF_RESKEY_monitor_ip + * fix indent + 2010/11/8 * fix bug in pgpool.monitor arguments. diff --git a/src/pgpool.in b/src/pgpool.in index 7fe10ce..f705996 100755 --- a/src/pgpool.in +++ b/src/pgpool.in @@ -4,7 +4,7 @@ # # Author: TANIDA Yutaka, TAKATSUKA Haruka # -# Copyright (c) 2006-2010 PgPool Global Development Group +# Copyright (c) 2006-2012 PgPool Global Development Group # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby @@ -18,7 +18,7 @@ # is" without express or implied warranty. # # defined OCF_RESKEY_value: -# pgpoolconf pcpconf hbaconf logfile pidfile options pgpooluser +# pgpoolconf pcpconf hbaconf logfile pidfile options pgpooluser monitor_ip # # default port number will be read from pgpool.conf automatically. @@ -71,6 +71,11 @@ if [ "x$OCF_RESKEY_pidfile" = 'x' ]; then else PGPOOL_PID=$OCF_RESKEY_pidfile fi +if [ "x$OCF_RESKEY_monitor_ip" = 'x' ]; then + PGPOOL_MONITOR_IP=127.0.0.1 +else + PGPOOL_MONITOR_IP=$OCF_RESKEY_monitor_ip +fi PGPOOL="$PGPOOLCMD -f $PGP_CONF" PGPOOL_START_ARG="" @@ -96,7 +101,7 @@ fi PGPOOL_STOP_ARG=" stop" PGPOOL_FORCE_STOP_ARG=" -m i $PGPOOL_STOP_ARG" PGPOOL_MONITOR=${PGPOOLCMD}.monitor -PGPOOL_MONITOR_ARGS="--conf=$PGP_CONF localhost" +PGPOOL_MONITOR_ARGS="--conf=$PGP_CONF $PGPOOL_MONITOR_IP" # Source function library. . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs @@ -118,22 +123,21 @@ case "$1" in stop) if check_pid then -# RET=`su -c "$PGPOOL $PGPOOL_STOP_ARG | grep ERROR" $PGPOOLUSER` -# ocf_log info "pgpoolRA: $RET" -# if [ -z "$RET" ] ; then -# exit 0 -# else -# try immediate stop. - RET=`su -c "$PGPOOL $PGPOOL_FORCE_STOP_ARG | grep ERROR " $PGPOOLUSER` - ocf_log info "pgpoolRA: $RET" - if [ -z "$RET" ] ; then - exit 0; - else - exit 7; - fi -# fi + RET=`su -c "$PGPOOL $PGPOOL_FORCE_STOP_ARG | grep ERROR " $PGPOOLUSER` + ocf_log info "pgpoolRA: $RET" + if [ -z "$RET" ] ; then + exit 0; + else + exit 7; + fi else ocf_log info "pgpoolRA: request stop, but not running." + if which pkill ; then + if pkill -P 1 pgpool ; then + ocf_log info "pgpoolRA: purge orphaned pgpool processes." + sleep 1 + fi + fi exit 0 fi ;; @@ -171,63 +175,70 @@ cat < - 1.0 - + 1.0 + OCF-spec start , stop ,and monitoring script for pgpool - - pgpool server control. - - + + 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. + Path to pool_hba.conf. pool_hba.conf - - + + Path to output logfile . logfile contains debuglog. if this entry is empty , log output is depends on pgpool. logfile - - + + Path to pgpool.pid pidfile - - + + additional options of pgpool-II start command. (e.g. -d) options - - + + pgpool-II user. (e.g. "postgres"(default), "pgpool" or "root") - options + pgpool user - + + + + pgpool-II monitor ip (e.g. "localhost"(default)) + + monitor ip + + - + @@ -235,7 +246,7 @@ cat < - + EOF exit 0;