View | Details | Raw Unified | Return to bug 36553
Collapse All | Expand All

(-)newsyslog/newsyslog.8 (-3 / +18 lines)
Lines 254-259 Link Here
254
rotate on every 5th day of month at 6:00 hr
254
rotate on every 5th day of month at 6:00 hr
255
.El
255
.El
256
.Pp
256
.Pp
257
.Em Note:
258
if you place asterisk 
259
.Pq Ql \&*
260
into both
261
.Ar size
262
and
263
.Ar when
264
fields the logfile will be turned over each time starting
265
.Nm .
266
.Pp
257
.It Ar flags
267
.It Ar flags
258
This optional field specifies if the archive should have any
268
This optional field specifies if the archive should have any
259
special processing done to the archived log files.
269
special processing done to the archived log files.
Lines 284-292 Link Here
284
the file name to read to find the daemon process id.  If this
294
the file name to read to find the daemon process id.  If this
285
field is present, a
295
field is present, a
286
.Ar signal_number
296
.Ar signal_number
287
is sent the process id contained in this
297
is sent the process id contained in this file; in other case
288
file.  This field must start with "/" in order to be recognized
298
.Nm
289
properly.
299
will tries sent signal to
300
.Xr syslogd 8 .
301
Please note, all path must be absolute, (i.e. paths must start with "/"
302
in order to be recognized properly). Place the dash
303
.Ar -
304
here if you don't want sent any signals to any processes.
290
.It Ar signal_number
305
.It Ar signal_number
291
This optional field specifies
306
This optional field specifies
292
the signal number will be sent to the daemon process.
307
the signal number will be sent to the daemon process.
(-)newsyslog/newsyslog.c (-6 / +20 lines)
Lines 25-31 Link Here
25
25
26
#ifndef lint
26
#ifndef lint
27
static const char rcsid[] =
27
static const char rcsid[] =
28
"$FreeBSD: src/usr.sbin/newsyslog/newsyslog.c,v 1.25.2.4 2001/11/14 16:58:58 obrien Exp $";
28
"$Id$";
29
#endif	/* not lint */
29
#endif	/* not lint */
30
30
31
#define OSF
31
#define OSF
Lines 67-72 Link Here
67
#define CE_BZCOMPACT 8		/* Compact the achived log files with bzip2 */
67
#define CE_BZCOMPACT 8		/* Compact the achived log files with bzip2 */
68
				/*  status messages */
68
				/*  status messages */
69
#define	CE_TRIMAT  4		/* trim at a specific time */
69
#define	CE_TRIMAT  4		/* trim at a specific time */
70
#define CE_SKIPNOTIFY 16	/* skip syslogd(8) notification */
70
71
71
#define NONE -1
72
#define NONE -1
72
73
Lines 167-183 Link Here
167
					    ctime(&ent->trim_at));
168
					    ctime(&ent->trim_at));
168
				return;
169
				return;
169
			} else if (verbose && ent->hours <= 0) {
170
			} else if (verbose && ent->hours <= 0) {
170
				printf("--> time is up\n");
171
				printf("time is up");
172
				if (ent->size < 0)
173
					printf(" or ");
174
				else
175
					printf(", ");
171
			}
176
			}
172
		}
177
		}
173
		if (verbose && (ent->size > 0))
178
		if (verbose && (ent->size > 0))
174
			printf("size (Kb): %d [%d] ", size, ent->size);
179
			printf("size (Kb): %d [%d] ", size, ent->size);
175
		if (verbose && (ent->hours > 0))
180
		if (verbose && (ent->hours > 0))
176
			printf(" age (hr): %d [%d] ", modtime, ent->hours);
181
			printf(" age (hr): %d [%d] ", modtime, ent->hours);
177
		if (force || ((ent->size > 0) && (size >= ent->size)) ||
182
		if (verbose && (ent->hours <= 0 && ent->size < 0)) 
183
			printf("always ");
184
		if ( force || ((ent->size > 0) && (size >= ent->size)) ||
178
		    (ent->hours <= 0 && (ent->flags & CE_TRIMAT)) ||
185
		    (ent->hours <= 0 && (ent->flags & CE_TRIMAT)) ||
179
		    ((ent->hours > 0) && ((modtime >= ent->hours)
186
		    ((ent->hours > 0) && ((modtime >= ent->hours) ||
180
			    || (modtime < 0)))) {
187
			(modtime < 0) )) ||
188
		    (ent->hours <= 0 && ent->size < 0) ) {
181
			if (verbose)
189
			if (verbose)
182
				printf("--> trimming log....\n");
190
				printf("--> trimming log....\n");
183
			if (noaction && !verbose) {
191
			if (noaction && !verbose) {
Lines 460-465 Link Here
460
		if (q && *q) {
468
		if (q && *q) {
461
			if (*q == '/')
469
			if (*q == '/')
462
				working->pid_file = strdup(q);
470
				working->pid_file = strdup(q);
471
			else if (*q == '-')
472
				working->flags |= CE_SKIPNOTIFY;
463
			else if (isdigit(*q))
473
			else if (isdigit(*q))
464
				goto got_sig;
474
				goto got_sig;
465
			else
475
			else
Lines 666-672 Link Here
666
		pid = get_pid(pid_file);
676
		pid = get_pid(pid_file);
667
	}
677
	}
668
	if (pid) {
678
	if (pid) {
669
		if (noaction) {
679
		if (flags & CE_SKIPNOTIFY) {
680
			notified = 1;
681
			if (verbose)
682
				printf("no syslogd(8) notification needed\n");
683
		} else if (noaction) {
670
			notified = 1;
684
			notified = 1;
671
			printf("kill -%d %d\n", sig, (int) pid);
685
			printf("kill -%d %d\n", sig, (int) pid);
672
		} else if (kill(pid, sig))
686
		} else if (kill(pid, sig))

Return to bug 36553