made rsync_options configurable

This commit is contained in:
trbs
2011-01-08 01:46:39 +01:00
committed by Greg Smith
parent 814863edf2
commit 52313a2d6e
4 changed files with 10 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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");

View File

@@ -1,3 +1,4 @@
cluster=test
node=2
conninfo='host=192.168.204.104'
rsync_options=--archive --checksum --compress --progress --rsh=ssh