From 7077a7c68fc6a3b2ab9649072b50f5a8f1fea3f6 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Sun, 27 Nov 2011 18:28:55 -0500 Subject: [PATCH] Add -w option to pg_ctl commands so we wait until command is finish. Or at least, we try. By default, after 60 seconds pg_ctl just return. This make useless to wait ourselves after pg_ctl start of witness so remove the sleep --- repmgr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/repmgr.c b/repmgr.c index 4c4a48e0..e2e733e2 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1356,7 +1356,7 @@ do_standby_follow(void) /* Finally, restart the service */ /* We assume the pg_ctl script is in the PATH */ - maxlen_snprintf(script, "pg_ctl -D %s -m fast restart", data_dir); + maxlen_snprintf(script, "pg_ctl -w -D %s -m fast restart", data_dir); r = system(script); if (r != 0) { @@ -1519,7 +1519,7 @@ do_witness_create(void) } /* start new instance */ - sprintf(script, "pg_ctl -D %s start", runtime_options.dest_dir); + sprintf(script, "pg_ctl -w -D %s start", runtime_options.dest_dir); log_info(_("Start cluster for witness: %s"), script); r = system(script); if (r != 0) @@ -1542,9 +1542,6 @@ do_witness_create(void) exit(ERR_DB_QUERY); } - /* Let the server start */ - sleep(2); - /* create the local user and local db if it is not the default one values[2] is the username we use to connect to master,