mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
Allow overriding start, stop and restart commands issued by repmgr
This commit introduces three new options: - start_command - stop_command - restart_command If these are set, repmgr will issue the specified command instead of the default pg_ctl commands
This commit is contained in:
24
repmgr.c
24
repmgr.c
@@ -2671,9 +2671,12 @@ do_standby_follow(void)
|
||||
exit(ERR_BAD_CONFIG);
|
||||
|
||||
/* Finally, restart the service */
|
||||
maxlen_snprintf(script, "%s %s -w -D %s -m fast restart",
|
||||
make_pg_path("pg_ctl"), options.pg_ctl_options, data_dir);
|
||||
|
||||
if (*options.restart_command) {
|
||||
maxlen_snprintf(script, "%s", options.restart_command);
|
||||
} else {
|
||||
maxlen_snprintf(script, "%s %s -w -D %s -m fast restart",
|
||||
make_pg_path("pg_ctl"), options.pg_ctl_options, data_dir);
|
||||
}
|
||||
log_notice(_("restarting server using '%s'\n"),
|
||||
script);
|
||||
|
||||
@@ -3145,12 +3148,15 @@ do_standby_switchover(void)
|
||||
* -> use -F/--force?
|
||||
*/
|
||||
|
||||
if (*options.stop_command) {
|
||||
maxlen_snprintf(command, "%s", options.stop_command);
|
||||
} else {
|
||||
maxlen_snprintf(command,
|
||||
"%s -D %s -m %s -W stop >/dev/null 2>&1 && echo 1 || echo 0",
|
||||
make_pg_path("pg_ctl"),
|
||||
remote_data_directory,
|
||||
runtime_options.pg_ctl_mode);
|
||||
|
||||
}
|
||||
initPQExpBuffer(&command_output);
|
||||
|
||||
// XXX handle failure
|
||||
@@ -3886,9 +3892,13 @@ do_witness_create(void)
|
||||
|
||||
|
||||
/* start new instance */
|
||||
maxlen_snprintf(script, "%s %s -w -D %s start",
|
||||
make_pg_path("pg_ctl"),
|
||||
options.pg_ctl_options, runtime_options.dest_dir);
|
||||
if (*options.start_command) {
|
||||
maxlen_snprintf(script, "%s", options.start_command);
|
||||
} else {
|
||||
maxlen_snprintf(script, "%s %s -w -D %s start",
|
||||
make_pg_path("pg_ctl"),
|
||||
options.pg_ctl_options, runtime_options.dest_dir);
|
||||
}
|
||||
log_info(_("starting witness server: %s\n"), script);
|
||||
r = system(script);
|
||||
if (r != 0)
|
||||
|
||||
Reference in New Issue
Block a user