From 6e818c9e9f6757f39f1e3e8243b88624c1abb812 Mon Sep 17 00:00:00 2001 From: pst Date: Sat, 14 Mar 1998 22:28:25 +0000 Subject: Add "-F" (force) flag to newsyslog. Submitted by: Terry Lambert --- usr.sbin/newsyslog/newsyslog.8 | 8 +++++++- usr.sbin/newsyslog/newsyslog.c | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'usr.sbin/newsyslog') 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(); } -- cgit v1.1