Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
2206abf8
Commit
2206abf8
authored
Jul 27, 2008
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a command-line override for daemon config parameters:
--dparam=PARAMETER=VALUE (-M PARAMETER=VALUE).
parent
fcd613d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
5 deletions
+74
-5
clientserver.c
clientserver.c
+1
-0
loadparm.c
loadparm.c
+31
-1
options.c
options.c
+20
-0
rsync.yo
rsync.yo
+9
-0
rsyncd.conf.yo
rsyncd.conf.yo
+13
-4
No files found.
clientserver.c
View file @
2206abf8
...
...
@@ -1040,6 +1040,7 @@ int daemon_main(void)
fprintf
(
stderr
,
"Failed to parse config file: %s
\n
"
,
config_file
);
exit_cleanup
(
RERR_SYNTAX
);
}
set_dparams
(
0
);
if
(
no_detach
)
create_pid_file
();
...
...
loadparm.c
View file @
2206abf8
...
...
@@ -45,6 +45,9 @@
#include "rsync.h"
#include "ifuncs.h"
extern
item_list
dparam_list
;
#define strequal(a, b) (strcasecmp(a, b)==0)
#define BOOLSTR(b) ((b) ? "Yes" : "No")
...
...
@@ -699,8 +702,11 @@ static BOOL do_section(char *sectionname)
isglobal
=
strwicmp
(
sectionname
,
GLOBAL_NAME
)
==
0
;
/* if we were in a global section then do the local inits */
if
(
bInGlobalSection
&&
!
isglobal
)
if
(
bInGlobalSection
&&
!
isglobal
)
{
if
(
!
section_list
.
count
)
set_dparams
(
0
);
init_locals
();
}
/* if we've just struck a global section, note the fact. */
bInGlobalSection
=
isglobal
;
...
...
@@ -745,6 +751,30 @@ int lp_load(char *pszFname, int globals_only)
return
pm_process
(
pszFname
,
globals_only
?
NULL
:
do_section
,
do_parameter
);
}
BOOL
set_dparams
(
int
syntax_check_only
)
{
char
*
equal
,
*
val
,
**
params
=
dparam_list
.
items
;
unsigned
j
;
for
(
j
=
0
;
j
<
dparam_list
.
count
;
j
++
)
{
equal
=
strchr
(
params
[
j
],
'='
);
/* options.c verified this */
*
equal
=
'\0'
;
if
(
syntax_check_only
)
{
if
(
map_parameter
(
params
[
j
])
<
0
)
{
rprintf
(
FCLIENT
,
"Unknown parameter
\"
%s
\"\n
"
,
params
[
j
]);
*
equal
=
'='
;
return
False
;
}
}
else
{
for
(
val
=
equal
+
1
;
isSpace
(
val
);
val
++
)
{}
do_parameter
(
params
[
j
],
val
);
}
*
equal
=
'='
;
}
return
True
;
}
/* Return the max number of modules (sections). */
int
lp_num_modules
(
void
)
{
...
...
options.c
View file @
2206abf8
...
...
@@ -121,6 +121,7 @@ int inplace = 0;
int
delay_updates
=
0
;
long
block_size
=
0
;
/* "long" because popt can't set an int32. */
char
*
skip_compress
=
NULL
;
item_list
dparam_list
=
EMPTY_ITEM_LIST
;
/** Network address family. **/
int
default_af_hint
...
...
@@ -992,6 +993,7 @@ static struct poptOption long_options[] = {
/* All the following options switch us into daemon-mode option-parsing. */
{
"config"
,
0
,
POPT_ARG_STRING
,
0
,
OPT_DAEMON
,
0
,
0
},
{
"daemon"
,
0
,
POPT_ARG_NONE
,
0
,
OPT_DAEMON
,
0
,
0
},
{
"dparam"
,
0
,
POPT_ARG_STRING
,
0
,
OPT_DAEMON
,
0
,
0
},
{
"detach"
,
0
,
POPT_ARG_NONE
,
0
,
OPT_DAEMON
,
0
,
0
},
{
"no-detach"
,
0
,
POPT_ARG_NONE
,
0
,
OPT_DAEMON
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
0
}
...
...
@@ -1006,6 +1008,7 @@ static void daemon_usage(enum logcode F)
rprintf
(
F
,
" --address=ADDRESS bind to the specified address
\n
"
);
rprintf
(
F
,
" --bwlimit=KBPS limit I/O bandwidth; KBytes per second
\n
"
);
rprintf
(
F
,
" --config=FILE specify alternate rsyncd.conf file
\n
"
);
rprintf
(
F
,
" -M, --dparam=OVERRIDE override global daemon config parameter
\n
"
);
rprintf
(
F
,
" --no-detach do not detach from the parent
\n
"
);
rprintf
(
F
,
" --port=PORT listen on alternate port number
\n
"
);
rprintf
(
F
,
" --log-file=FILE override the
\"
log file
\"
setting
\n
"
);
...
...
@@ -1027,6 +1030,7 @@ static struct poptOption long_daemon_options[] = {
{
"bwlimit"
,
0
,
POPT_ARG_INT
,
&
daemon_bwlimit
,
0
,
0
,
0
},
{
"config"
,
0
,
POPT_ARG_STRING
,
&
config_file
,
0
,
0
,
0
},
{
"daemon"
,
0
,
POPT_ARG_NONE
,
&
daemon_opt
,
0
,
0
,
0
},
{
"dparam"
,
'M'
,
POPT_ARG_STRING
,
0
,
'M'
,
0
,
0
},
{
"ipv4"
,
'4'
,
POPT_ARG_VAL
,
&
default_af_hint
,
AF_INET
,
0
,
0
},
{
"ipv6"
,
'6'
,
POPT_ARG_VAL
,
&
default_af_hint
,
AF_INET6
,
0
,
0
},
{
"detach"
,
0
,
POPT_ARG_VAL
,
&
no_detach
,
0
,
0
,
0
},
...
...
@@ -1310,11 +1314,24 @@ int parse_arguments(int *argc_p, const char ***argv_p)
pc
=
poptGetContext
(
RSYNC_NAME
,
argc
,
argv
,
long_daemon_options
,
0
);
while
((
opt
=
poptGetNextOpt
(
pc
))
!=
-
1
)
{
char
**
cpp
;
switch
(
opt
)
{
case
'h'
:
daemon_usage
(
FINFO
);
exit_cleanup
(
0
);
case
'M'
:
arg
=
poptGetOptArg
(
pc
);
if
(
!
strchr
(
arg
,
'='
))
{
rprintf
(
FERROR
,
"--dparam value is missing an '=': %s
\n
"
,
arg
);
goto
daemon_error
;
}
cpp
=
EXPAND_ITEM_LIST
(
&
dparam_list
,
char
*
,
4
);
*
cpp
=
strdup
(
arg
);
break
;
case
'v'
:
verbose
++
;
break
;
...
...
@@ -1328,6 +1345,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
}
}
if
(
dparam_list
.
count
&&
!
set_dparams
(
1
))
exit_cleanup
(
RERR_SYNTAX
);
if
(
tmpdir
&&
strlen
(
tmpdir
)
>=
MAXPATHLEN
-
10
)
{
snprintf
(
err_buf
,
sizeof
err_buf
,
"the --temp-dir path is WAY too long.
\n
"
);
...
...
rsync.yo
View file @
2206abf8
...
...
@@ -438,6 +438,7 @@ accepted: verb(
--address=ADDRESS bind to the specified address
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--config=FILE specify alternate rsyncd.conf file
-M, --dparam=OVERRIDE override global daemon config parameter
--no-detach do not detach from the parent
--port=PORT listen on alternate port number
--log-file=FILE override the "log file" setting
...
...
@@ -2220,6 +2221,14 @@ The default is /etc/rsyncd.conf unless the daemon is running over
a remote shell program and the remote user is not the super-user; in that case
the default is rsyncd.conf in the current directory (typically $HOME).
dit(bf(-M, --dparam=OVERRIDE)) This option can be used to set a daemon-config
parameter when starting up rsync in daemon mode. It is equivalent to adding
the parameter at the end of the global settings prior to the first module's
definition. The parameter names can be specified without spaces, if you so
desire. For instance:
verb( rsync --daemon -M pidfile=/path/rsync.pid )
dit(bf(--no-detach)) When running as a daemon, this option instructs
rsync to not detach itself and become a background process. This
option is required when running as a service on Cygwin, and may also
...
...
rsyncd.conf.yo
View file @
2206abf8
...
...
@@ -83,10 +83,14 @@ dit(bf(motd file)) This parameter allows you to specify a
"message of the day" to display to clients on each connect. This
usually contains site information and any legal notices. The default
is no motd file.
This can be overridden by the bf(--dparam=motdfile=FILE)
command-line option when starting the daemon.
dit(bf(pid file)) This parameter tells the rsync daemon to write
its process ID to that file. If the file already exists, the rsync
daemon will abort rather than overwrite the file.
This can be overridden by the bf(--dparam=pidfile=FILE)
command-line option when starting the daemon.
dit(bf(port)) You can override the default port the daemon will listen on
by specifying this value (defaults to 873). This is ignored if the daemon
...
...
@@ -101,12 +105,11 @@ who like to tune their systems to the utmost degree. You can set all
sorts of socket options which may make transfers faster (or
slower!). Read the man page for the code(setsockopt()) system call for
details on some of the options you may be able to set. By default no
special socket options are set. These settings
are superseded by the
bf(--sockopts) command-line option.
special socket options are set. These settings
can also be specified
via the
bf(--sockopts) command-line option.
enddit()
manpagesection(MODULE PARAMETERS)
After the global parameters you should define a number of modules, each
...
...
@@ -256,10 +259,16 @@ the transfer. If this value is set on a per-module basis instead of
globally, the global log will still contain any authorization failures
or config-file error messages.
If the daemon fails to open t
o
specified file, it will fall back to
If the daemon fails to open t
he
specified file, it will fall back to
using syslog and output an error about the failure. (Note that the
failure to open the specified log file used to be a fatal error.)
This setting can be overridden by using the bf(--log-file=FILE) or
bf(--dparam=logfile=FILE) command-line options. The former overrides
all the log-file parameters of the daemon and all module settings.
The latter sets the daemon's log file and the default for all the
modules, which still allows modules to override the default setting.
dit(bf(syslog facility)) This parameter allows you to
specify the syslog facility name to use when logging messages from the
rsync daemon. You may use any standard syslog facility name which is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment