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:19:56 +0000 (23:19 +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 8e85380293e7fa0019921be4311a1d51669ca8e3..02c00c5abb6e3f33fc7a43c2c2480f5b81f880d7 100755 (executable)
@@ -773,8 +773,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