mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
made rsync_options configurable
This commit is contained in:
3
config.c
3
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);
|
||||
}
|
||||
|
||||
1
config.h
1
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);
|
||||
|
||||
6
repmgr.c
6
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");
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
cluster=test
|
||||
node=2
|
||||
conninfo='host=192.168.204.104'
|
||||
rsync_options=--archive --checksum --compress --progress --rsh=ssh
|
||||
|
||||
Reference in New Issue
Block a user