pgpool2.git / summary / log / commit / refs
commit 4e56118ad418f87652bdf8bf42460f45a6b66a12
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Wed May 28 04:37:42 2014 +0000
Fix pgpool.init's long-standing bug of stop/restart failure
In previous, pgpool.init uses killproc for stopping pgpool, but there are
several problems; (1) some child processes can be left since the parent
process restarts killed processes; (2) when pgpool has connection from
clients, pgpool can't stop until connection closed; (3) restart() fails
for these reasons.
In the new version, "pgpool -m fast stop" is used in stop(). The problems
above are resolved and restart() also works well, even when watchdog enabled.
In addition, exit code according with LSB is considered, try-restart
option is implemented, and the old switch option is removed.
Original patch contributed by Ryan DeShone and modified by Yugo Nagata.
See [pgpool-hackers: 239][pgpool-hackers: 512].
src/redhat/pgpool.init | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/redhat/pgpool.init b/src/redhat/pgpool.init
index d2aaf05e8..b802a9b8c 100644
--- a/src/redhat/pgpool.init
+++ b/src/redhat/pgpool.init
@@ -15,10 +15,11 @@
# v2.2.5 Devrim GUNDUZ <devrim@CommandPrompt.com>
# - Fix logging.
#
-# v3.0.0 Yugo Nagata <nagata@sraoss.co.jp>
-# - Fix stop and reload functions
-# - Fix exit code according with LSB
+# v3.3.3 Ryan Deshone <rdshone@liquidweb.com> and Yugo Nagata <nagata@sraoss.co.jp>
+# - Update stop and reload to use pgpool commands properly
+# - Removed "switch" as pgpool no longer suppports that command
# - Add try-restart option
+# - Fix exit code according with LSB
# Source function library.
INITD=/etc/rc.d/init.d
@@ -60,8 +61,8 @@ PGPOOLLOG=/var/log/pgpool.log
lockfile="/var/lock/subsys/${NAME}"
pidfile="$PGPOOLPIDDIR/pgpool.pid"
-# Override defaults from /etc/sysconfig/pgpool if file is present
-[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
+# Import configuration from /etc/sysconfig, if it exists
+[ -f /etc/sysconfig/${NAME} ] && . /etc/sysconfig/${NAME}
test -x $PGPOOLDAEMON || exit 5
@@ -78,13 +79,13 @@ fi
if [ ! -x $PGPOOLLOG ]
then
touch $PGPOOLLOG
- chown $PGPOOLUSER: $PGPOOLLOG
+ chown ${PGPOOLUSER}: $PGPOOLLOG
fi
if [ ! -d $PGPOOLPIDDIR ]
then
mkdir $PGPOOLPIDDIR
- chown $PGPOOLUSER: $PGPOOLPIDDIR
+ chown ${PGPOOLUSER}: $PGPOOLPIDDIR
fi
script_result=0
@@ -123,7 +124,6 @@ stop(){
then
$SU -l $PGPOOLUSER -c "$PGPOOLDAEMON -f $PGPOOLCONF -m fast stop" >> "$PGPOOLLOG" 2>&1 < /dev/null
- #if [ -n "`pidofproc -p $pidfile $PGPOOLDAEMON`" ]
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
@@ -145,7 +145,7 @@ restart(){
}
reload(){
- PGPOOL_RELOAD=$"Reloading ${NAME}: "
+ PGPOOL_RELOAD=$"Reloading ${NAME} configuration: "
echo -n "$PGPOOL_RELOAD"
if [ -n "`pidofproc -p $pidfile $PGPOOLDAEMON`" ]
[parent: e958833aaedc]