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:41 +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 45eff35f61c292d05b3e0c47f3d446ed6c4f19e0..3624497ec03349f90d76e38aa5a386cca60e4cc0 100755 (executable)
@@ -900,8 +900,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