Fix pgpool_setup to produce correct follow master command.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 28 Jul 2019 02:11:07 +0000 (11:11 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 28 Jul 2019 02:17:01 +0000 (11:17 +0900)
The produced script incorrectly checked whether PostgreSQL is running
or not, which resulted in that it mistakenly thought PostgreSQL is
always running.

src/test/pgpool_setup

index f386c1e4d12cfa78947ca267ec2bc7acf3e5510d..bc9bd48f5ab5f38cb604602b089c1d3a10660fd0 100755 (executable)
@@ -208,7 +208,8 @@ date >> $log
 echo "failed_node_id $failed_node_id failed_host_name $failed_host_name failed_port $failed_port failed_db_cluster $failed_db_cluster new_master_id $new_master_id old_master_id $old_master_id new_master_host_name $new_master_host_name old_primary_node_id $old_primary_node_id new_master_port_number $new_master_port_number new_master_db_cluster $new_master_db_cluster" >> $log
 
 # Stop standby node if it's running
-if $pg_ctl -D $failed_db_cluster status|grep "is running" >/dev/null 2>&1
+$pg_ctl -D $failed_db_cluster status >/dev/null 2>&1
+if [ $? = 0 ]
 then
        $pg_ctl -w -m f -D $failed_db_cluster stop >> $log 2>&1
        sleep 10