Add "-F" (force) flag to newsyslog.
Submitted by: Terry Lambert <terry@freebsd.org>
This commit is contained in:
parent
26555b64bc
commit
07d95a3e31
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=34584
@ -1,7 +1,7 @@
|
||||
.\" This file contains changes from the Open Software Foundation.
|
||||
.\"
|
||||
.\" from: @(#)newsyslog.8
|
||||
.\" $Id: newsyslog.8,v 1.8 1997/06/23 04:03:49 steve Exp $
|
||||
.\" $Id: newsyslog.8,v 1.9 1997/10/06 07:46:06 charnier Exp $
|
||||
.\"
|
||||
.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
|
||||
.\"
|
||||
@ -152,6 +152,12 @@ must be running as root. Of course,
|
||||
will not be able to send a HUP signal to
|
||||
.Xr syslogd 8
|
||||
so this option should only be used in debugging.
|
||||
.It Fl F
|
||||
Force
|
||||
.Nm
|
||||
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.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/newsyslog.confxxxx -compact
|
||||
|
@ -27,7 +27,7 @@ provided "as is" without express or implied warranty.
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: newsyslog.c,v 1.14 1997/10/06 07:46:08 charnier Exp $";
|
||||
"$Id: newsyslog.c,v 1.15 1997/11/30 18:58:18 ache Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef CONF
|
||||
@ -89,6 +89,7 @@ struct conf_entry {
|
||||
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 force = 0; /* Force the tim no matter what*/
|
||||
char *conf = CONF; /* Configuration file to use */
|
||||
time_t timenow;
|
||||
pid_t syslog_pid; /* read in from /etc/syslog.pid */
|
||||
@ -159,7 +160,7 @@ static void do_entry(ent)
|
||||
printf("size (Kb): %d [%d] ", size, ent->size);
|
||||
if (verbose && (ent->hours > 0))
|
||||
printf(" age (hr): %d [%d] ", modtime, ent->hours);
|
||||
if (((ent->size > 0) && (size >= ent->size)) ||
|
||||
if (force || ((ent->size > 0) && (size >= ent->size)) ||
|
||||
((ent->hours > 0) && ((modtime >= ent->hours)
|
||||
|| (modtime < 0)))) {
|
||||
if (verbose)
|
||||
@ -201,7 +202,7 @@ static void PRS(argc,argv)
|
||||
}
|
||||
|
||||
optind = 1; /* Start options parsing */
|
||||
while ((c=getopt(argc,argv,"nrvf:t:")) != -1)
|
||||
while ((c=getopt(argc,argv,"nrvFf:t:")) != -1)
|
||||
switch (c) {
|
||||
case 'n':
|
||||
noaction++; /* This implies needroot as off */
|
||||
@ -215,6 +216,9 @@ static void PRS(argc,argv)
|
||||
case 'f':
|
||||
conf = optarg;
|
||||
break;
|
||||
case 'F':
|
||||
force++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user