From 52313a2d6e1c7edceee12801cbde59a542fe797b Mon Sep 17 00:00:00 2001 From: trbs Date: Sat, 8 Jan 2011 01:46:39 +0100 Subject: [PATCH] made rsync_options configurable --- config.c | 3 +++ config.h | 1 + repmgr.c | 6 +++++- repmgr.conf | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 43843581..c3df1b89 100644 --- a/config.c +++ b/config.c @@ -39,6 +39,7 @@ parse_config(const char *config_file, repmgr_config *config) memset(config->cluster_name, 0, sizeof(config->cluster_name)); config->node = -1; memset(config->conninfo, 0, sizeof(config->conninfo)); + memset(config->rsync_options, 0, sizeof(config->rsync_options)); /* Read next line */ while ((s = fgets (buff, sizeof buff, fp)) != NULL) @@ -57,6 +58,8 @@ parse_config(const char *config_file, repmgr_config *config) config->node = atoi(value); else if (strcmp(name, "conninfo") == 0) strncpy (config->conninfo, value, MAXLEN); + else if (strcmp(name, "rsync_options") == 0) + strncpy (config->rsync_options, value, QUERY_STR_LEN); else printf ("WARNING: %s/%s: Unknown name/value pair!\n", name, value); } diff --git a/config.h b/config.h index e4710ea8..b66bc6e4 100644 --- a/config.h +++ b/config.h @@ -22,6 +22,7 @@ typedef struct char cluster_name[MAXLEN]; int node; char conninfo[MAXLEN]; + char rsync_options[QUERY_STR_LEN]; } repmgr_config; void parse_config(const char *config_file, repmgr_config *config); diff --git a/repmgr.c b/repmgr.c index 26ebe7cd..b8d2540a 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1237,7 +1237,11 @@ copy_remote_files(char *host, char *remote_user, char *remote_path, char *local_ char host_string[QUERY_STR_LEN]; int r; - sprintf(options, "--archive --checksum --compress --progress --rsh=ssh"); + if (strnlen(config.rsync_options, QUERY_STR_LEN) == 0) + sprintf(options, "--archive --checksum --compress --progress --rsh=ssh"); + else + strncpy(options, config.rsync_options, QUERY_STR_LEN); + if (force) strcat(options, " --delete"); diff --git a/repmgr.conf b/repmgr.conf index f7287502..a707dc42 100644 --- a/repmgr.conf +++ b/repmgr.conf @@ -1,3 +1,4 @@ cluster=test node=2 conninfo='host=192.168.204.104' +rsync_options=--archive --checksum --compress --progress --rsh=ssh