summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1998-03-14 22:28:25 +0000
committerpst <pst@FreeBSD.org>1998-03-14 22:28:25 +0000
commit6e818c9e9f6757f39f1e3e8243b88624c1abb812 (patch)
tree7b1125b2e251d77c71823ac1f2f9493741b33da1 /usr.sbin/newsyslog
parentfb0b69a9d2b895e3a9e377684059188e3bf22a75 (diff)
downloadFreeBSD-src-6e818c9e9f6757f39f1e3e8243b88624c1abb812.zip
FreeBSD-src-6e818c9e9f6757f39f1e3e8243b88624c1abb812.tar.gz
Add "-F" (force) flag to newsyslog.
Submitted by: Terry Lambert <terry@freebsd.org>
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.88
-rw-r--r--usr.sbin/newsyslog/newsyslog.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8
index c805197..5841519 100644
--- a/usr.sbin/newsyslog/newsyslog.8
+++ b/usr.sbin/newsyslog/newsyslog.8
@@ -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
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 41fc2b2..13fff30 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -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();
}
OpenPOWER on IntegriCloud