diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8 --- a/usr.sbin/newsyslog/newsyslog.8 +++ b/usr.sbin/newsyslog/newsyslog.8 @@ -14,7 +14,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd September 1, 2025 +.Dd September 22, 2025 .Dt NEWSYSLOG 8 .Os .Sh NAME @@ -26,6 +26,7 @@ .Op Fl a Ar directory .Op Fl d Ar directory .Op Fl f Ar config_file +.Op Fl I Ar signal .Op Fl S Ar pidfile .Op Fl t Ar timefmt .Op Oo Fl R Ar tagname Oc Ar @@ -132,7 +133,7 @@ must be running as root. Of course, .Nm -will not be able to send a HUP signal to +will not be able to send a signal to .Xr syslogd 8 so this option should only be used in debugging. .It Fl s @@ -247,6 +248,10 @@ will return faster, since .Nm normally waits a few seconds after any signal that is sent. +.It Fl I Ar signal +Specify signal to send for entries that do not have signal configured. +This option accepts either a signal number or a name as argument. +The default value is HUP. .It Fl S Ar pidfile Use .Ar pidfile diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -241,6 +241,7 @@ static int nosignal; /* Do not send any signals */ static int enforcepid = 0; /* If PID file does not exist or empty, do nothing */ static int force = 0; /* Force the trim no matter what */ +static int defsignal = SIGHUP; /* -I Signal to send by default */ static int rotatereq = 0; /* -R = Always rotate the file(s) as given */ /* on the command (this also requires */ /* that a list of files *are* given on */ @@ -455,7 +456,7 @@ tempwork->permissions = 0; tempwork->flags = 0; tempwork->compress = COMPRESS_NONE; - tempwork->sig = SIGHUP; + tempwork->sig = defsignal; tempwork->def_cfg = 0; } @@ -700,7 +701,7 @@ hostname_shortlen = strcspn(hostname, "."); /* Parse command line options. */ - while ((ch = getopt(argc, argv, "a:d:f:nrst:vCD:FNPR:S:")) != -1) + while ((ch = getopt(argc, argv, "a:d:f:nrst:vCD:FI:NPR:S:")) != -1) switch (ch) { case 'a': archtodir++; @@ -748,6 +749,10 @@ case 'F': force++; break; + case 'I': + if (str2sig(optarg, &defsignal) != 0) + usage(); + break; case 'N': norotate++; break; @@ -846,7 +851,7 @@ fprintf(stderr, "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]\n" - " [-S pidfile] [-t timefmt] [[-R tagname] file ...]\n"); + " [-I signal] [-S pidfile] [-t timefmt] [[-R tagname] file ...]\n"); exit(1); } @@ -1481,7 +1486,7 @@ *parse = '\0'; } - working->sig = SIGHUP; + working->sig = defsignal; if (q && *q) { got_sig: if (str2sig(q, &working->sig) != 0) {