mirror of
https://github.com/bstansell/conserver.git
synced 2024-12-21 05:43:10 +00:00
conserver.cf: second resolution for reinitcheck
Add support for specifying `reinitcheck` in seconds instead of default minutes. If no unit is specified, minutes are used for backward compatibility. Signed-off-by: Jacek Tomasiak <jtomasiak@arista.com> Signed-off-by: Jacek Tomasiak <jacek.tomasiak@gmail.com>
This commit is contained in:
parent
5cd5df957c
commit
0631fe04e6
@ -385,11 +385,14 @@ Turn redirection on or off (see the
|
|||||||
.B \-R
|
.B \-R
|
||||||
command-line flag).
|
command-line flag).
|
||||||
.TP
|
.TP
|
||||||
\f3reinitcheck\fP \f2number\fP
|
\f3reinitcheck\fP \f2number\fP[\f3s\fP|\f3m\fP]
|
||||||
.br
|
.br
|
||||||
Set the number of minutes used between reinitialization checks (see the
|
Set the number of minutes used between reinitialization checks (see the
|
||||||
.B \-O
|
.B \-O
|
||||||
command-line flag).
|
command-line flag).
|
||||||
|
If an `s' or `m' is used after
|
||||||
|
.IR number ,
|
||||||
|
the specified time is interpreted as seconds or minutes.
|
||||||
.TP
|
.TP
|
||||||
\f3secondaryport\fP \f2number\fP|\f2name\fP
|
\f3secondaryport\fP \f2number\fP|\f2name\fP
|
||||||
.br
|
.br
|
||||||
|
@ -1023,7 +1023,7 @@ ReUp(GRPENT *pGE, short automatic)
|
|||||||
/* update all the timers */
|
/* update all the timers */
|
||||||
if (automatic == 0 || automatic == 2) {
|
if (automatic == 0 || automatic == 2) {
|
||||||
if (config->reinitcheck)
|
if (config->reinitcheck)
|
||||||
timers[T_REINIT] = tyme + (config->reinitcheck * 60);
|
timers[T_REINIT] = tyme + config->reinitcheck;
|
||||||
}
|
}
|
||||||
if (!fNoautoreup)
|
if (!fNoautoreup)
|
||||||
timers[T_AUTOUP] = tyme + 60;
|
timers[T_AUTOUP] = tyme + 60;
|
||||||
|
@ -1365,7 +1365,7 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
/* How often to try opening all down consoles, in minutes */
|
/* How often to try opening all down consoles, in minutes */
|
||||||
optConf->reinitcheck = atoi(optarg);
|
optConf->reinitcheck = atoi(optarg) * 60;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if ((optConf->primaryport = StrDup(optarg)) == (char *)0)
|
if ((optConf->primaryport = StrDup(optarg)) == (char *)0)
|
||||||
|
@ -4562,6 +4562,7 @@ void
|
|||||||
ConfigItemReinitcheck(char *id)
|
ConfigItemReinitcheck(char *id)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
int factor = 0;
|
||||||
|
|
||||||
CONDDEBUG((1, "ConfigItemReinitcheck(%s) [%s:%d]", id, file, line));
|
CONDDEBUG((1, "ConfigItemReinitcheck(%s) [%s:%d]", id, file, line));
|
||||||
|
|
||||||
@ -4570,18 +4571,22 @@ ConfigItemReinitcheck(char *id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = id; *p != '\000'; p++)
|
for (p = id; factor == 0 && *p != '\000'; p++)
|
||||||
if (!isdigit((int)(*p)))
|
if (*p == 's' || *p == 'S')
|
||||||
|
factor = 1;
|
||||||
|
else if (*p == 'm' || *p == 'M')
|
||||||
|
factor = 60;
|
||||||
|
else if (!isdigit((int)(*p)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* if it wasn't a number */
|
/* if it wasn't a number or a qualifier wasn't at the end */
|
||||||
if (*p != '\000') {
|
if (*p != '\000') {
|
||||||
if (isMaster)
|
if (isMaster)
|
||||||
Error("invalid reinitcheck value `%s' [%s:%d]", id, file,
|
Error("invalid reinitcheck value `%s' [%s:%d]", id, file,
|
||||||
line);
|
line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parserConfigTemp->reinitcheck = atoi(id);
|
parserConfigTemp->reinitcheck = atoi(id) * (factor == 0 ? 60 : factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -18,7 +18,7 @@ typedef struct config {
|
|||||||
char *primaryport;
|
char *primaryport;
|
||||||
FLAG redirect;
|
FLAG redirect;
|
||||||
FLAG loghostnames;
|
FLAG loghostnames;
|
||||||
int reinitcheck;
|
int reinitcheck; /* stored in sec, configured in min or sec */
|
||||||
char *secondaryport;
|
char *secondaryport;
|
||||||
char *unifiedlog;
|
char *unifiedlog;
|
||||||
int initdelay;
|
int initdelay;
|
||||||
|
@ -7,6 +7,9 @@ default * {
|
|||||||
timestamp "";
|
timestamp "";
|
||||||
include full;
|
include full;
|
||||||
}
|
}
|
||||||
|
config * {
|
||||||
|
reinitcheck 1s;
|
||||||
|
}
|
||||||
break 5 {
|
break 5 {
|
||||||
string "\rtest\r";
|
string "\rtest\r";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user