--- newsyslog/newsyslog.8 Sun Mar 31 00:38:19 2002 +++ newsyslog/newsyslog.8 Sat Mar 30 06:34:07 2002 @@ -254,6 +254,16 @@ rotate on every 5th day of month at 6:00 hr .El .Pp +.Em Note: +if you place asterisk +.Pq Ql \&* +into both +.Ar size +and +.Ar when +fields the logfile will be turned over each time starting +.Nm . +.Pp .It Ar flags This optional field specifies if the archive should have any special processing done to the archived log files. @@ -284,9 +294,14 @@ the file name to read to find the daemon process id. If this field is present, a .Ar signal_number -is sent the process id contained in this -file. This field must start with "/" in order to be recognized -properly. +is sent the process id contained in this file; in other case +.Nm +will tries sent signal to +.Xr syslogd 8 . +Please note, all path must be absolute, (i.e. paths must start with "/" +in order to be recognized properly). Place the dash +.Ar - +here if you don't want sent any signals to any processes. .It Ar signal_number This optional field specifies the signal number will be sent to the daemon process. --- newsyslog/newsyslog.c Sun Mar 31 00:38:21 2002 +++ newsyslog/newsyslog.c Sun Mar 31 01:03:25 2002 @@ -25,7 +25,7 @@ #ifndef lint static const char rcsid[] = -"$FreeBSD: src/usr.sbin/newsyslog/newsyslog.c,v 1.25.2.4 2001/11/14 16:58:58 obrien Exp $"; +"$Id$"; #endif /* not lint */ #define OSF @@ -67,6 +67,7 @@ #define CE_BZCOMPACT 8 /* Compact the achived log files with bzip2 */ /* status messages */ #define CE_TRIMAT 4 /* trim at a specific time */ +#define CE_SKIPNOTIFY 16 /* skip syslogd(8) notification */ #define NONE -1 @@ -167,17 +168,24 @@ ctime(&ent->trim_at)); return; } else if (verbose && ent->hours <= 0) { - printf("--> time is up\n"); + printf("time is up"); + if (ent->size < 0) + printf(" or "); + else + printf(", "); } } if (verbose && (ent->size > 0)) printf("size (Kb): %d [%d] ", size, ent->size); if (verbose && (ent->hours > 0)) printf(" age (hr): %d [%d] ", modtime, ent->hours); - if (force || ((ent->size > 0) && (size >= ent->size)) || + if (verbose && (ent->hours <= 0 && ent->size < 0)) + printf("always "); + if ( force || ((ent->size > 0) && (size >= ent->size)) || (ent->hours <= 0 && (ent->flags & CE_TRIMAT)) || - ((ent->hours > 0) && ((modtime >= ent->hours) - || (modtime < 0)))) { + ((ent->hours > 0) && ((modtime >= ent->hours) || + (modtime < 0) )) || + (ent->hours <= 0 && ent->size < 0) ) { if (verbose) printf("--> trimming log....\n"); if (noaction && !verbose) { @@ -460,6 +468,8 @@ if (q && *q) { if (*q == '/') working->pid_file = strdup(q); + else if (*q == '-') + working->flags |= CE_SKIPNOTIFY; else if (isdigit(*q)) goto got_sig; else @@ -666,7 +676,11 @@ pid = get_pid(pid_file); } if (pid) { - if (noaction) { + if (flags & CE_SKIPNOTIFY) { + notified = 1; + if (verbose) + printf("no syslogd(8) notification needed\n"); + } else if (noaction) { notified = 1; printf("kill -%d %d\n", sig, (int) pid); } else if (kill(pid, sig))