Add the -N option to not rotate any files. This is to be used in
cojunction with -C and is used by /etc/rc.d/newsyslog. I forgot that this was in my perforce tree and not my running system and thus committed a non-working newsyslog script. Reported by: des Pointy hat: brooks
This commit is contained in:
parent
573d78add6
commit
deea909a70
@ -25,7 +25,7 @@
|
||||
.Nd maintain system log files to manageable sizes
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl CFnrsv
|
||||
.Op Fl CFNnrsv
|
||||
.Op Fl R Ar tagname
|
||||
.Op Fl a Ar directory
|
||||
.Op Fl d Ar directory
|
||||
@ -162,6 +162,13 @@ to trim the logs, even if the trim conditions have not been met.
|
||||
This
|
||||
option is useful for diagnosing system problems by providing you with
|
||||
fresh logs that contain only the problems.
|
||||
.It Fl N
|
||||
Do not perform any rotations.
|
||||
This option is intended to be used with the
|
||||
.Fl C
|
||||
or
|
||||
.Fl CC
|
||||
options when creating log files is the only objective.
|
||||
.It Fl R Ar tagname
|
||||
Specify that
|
||||
.Nm
|
||||
|
@ -179,6 +179,7 @@ int createlogs; /* Create (non-GLOB) logfiles which do not */
|
||||
int verbose = 0; /* Print out what's going on */
|
||||
int needroot = 1; /* Root privs are necessary */
|
||||
int noaction = 0; /* Don't do anything, just show it */
|
||||
int norotate = 0; /* Don't rotate */
|
||||
int nosignal; /* Do not send any signals */
|
||||
int force = 0; /* Force the trim no matter what */
|
||||
int rotatereq = 0; /* -R = Always rotate the file(s) as given */
|
||||
@ -557,7 +558,7 @@ do_entry(struct conf_entry * ent)
|
||||
/*
|
||||
* If the file needs to be rotated, then rotate it.
|
||||
*/
|
||||
if (ent->rotate) {
|
||||
if (ent->rotate && !norotate) {
|
||||
if (temp_reason[0] != '\0')
|
||||
ent->r_reason = strdup(temp_reason);
|
||||
if (verbose)
|
||||
@ -698,7 +699,7 @@ parse_args(int argc, char **argv)
|
||||
*p = '\0';
|
||||
|
||||
/* Parse command line options. */
|
||||
while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FR:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FNR:")) != -1)
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
archtodir++;
|
||||
@ -739,6 +740,9 @@ parse_args(int argc, char **argv)
|
||||
case 'F':
|
||||
force++;
|
||||
break;
|
||||
case 'N':
|
||||
norotate++;
|
||||
break;
|
||||
case 'R':
|
||||
rotatereq++;
|
||||
requestor = strdup(optarg);
|
||||
@ -749,6 +753,12 @@ parse_args(int argc, char **argv)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
if (force && norotate) {
|
||||
warnx("Only one of -F and -N may be specified.");
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
if (rotatereq) {
|
||||
if (optind == argc) {
|
||||
warnx("At least one filename must be given when -R is specified.");
|
||||
@ -838,7 +848,7 @@ usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: newsyslog [-CFnrsv] [-a directory] [-d directory] [-f config-file]\n"
|
||||
"usage: newsyslog [-CFNnrsv] [-a directory] [-d directory] [-f config-file]\n"
|
||||
" [ [-R requestor] filename ... ]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user