Enhance pgpool_setup.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 2 Feb 2021 14:12:37 +0000 (23:12 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 2 Feb 2021 14:18:59 +0000 (23:18 +0900)
"shutdownall" script unconditionally waited for the pgpool.pid file is
gone after "pgpool stop".  But if invalid pgpool.pid file exists, it
waits forever. To avoid this check the exit status of "pgpool stop"
and only wait if the exit status is 0.

src/test/pgpool_setup.in

index 389bcc0c9cc5bfb68f6bba0f130e35cdbd95761a..65c0df926b827b54175c99d9be3dbd307a568521 100644 (file)
@@ -902,8 +902,7 @@ echo "PGPOOL_INSTALL_DIR=$PGPOOL_INSTALL_DIR" >> $STARTALL
 chmod 755 $STARTALL
 echo 'dir=`pwd`' > $SHUTDOWNALL
 echo "PGPOOL_INSTALL_DIR=$PGPOOL_INSTALL_DIR" >> $SHUTDOWNALL
-echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf -m f stop' >> $SHUTDOWNALL
-echo 'while [ -f $dir/run/pgpool.pid ];do sleep 1;done' >> $SHUTDOWNALL
+echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf -m f stop && while [ -f $dir/run/pgpool.pid ];do sleep 1;done' >> $SHUTDOWNALL
 if [ $CHECK_TIME_WAIT != "false" ];then
    echo "while  netstat -a|grep $ORIGBASEPORT ;do sleep 1;done" >> $SHUTDOWNALL
 fi