diff options
author | brian <brian@FreeBSD.org> | 2010-07-23 09:11:47 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2010-07-23 09:11:47 +0000 |
commit | c77452c8de7227230017ce6d96aa4e7c069c7b0f (patch) | |
tree | 0eaa61d61131d0d7f8c211f7925327f514f10e7b /usr.sbin/newsyslog | |
parent | 9712144a3f9fd88e1fdf5d780ef7a89530570711 (diff) | |
download | FreeBSD-src-c77452c8de7227230017ce6d96aa4e7c069c7b0f.zip FreeBSD-src-c77452c8de7227230017ce6d96aa4e7c069c7b0f.tar.gz |
Add a -S switch to override the default syslog pid file. This can be useful
if syslogd's -P switch or a syslogd alternative is being used.
MFC after: 3 weeks
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.8 | 9 | ||||
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 9 | ||||
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.conf.5 | 17 |
3 files changed, 25 insertions, 10 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8 index 58881a2..312080b 100644 --- a/usr.sbin/newsyslog/newsyslog.8 +++ b/usr.sbin/newsyslog/newsyslog.8 @@ -17,7 +17,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd January 19, 2010 +.Dd July 23, 2010 .Dt NEWSYSLOG 8 .Os .Sh NAME @@ -27,6 +27,7 @@ .Nm .Op Fl CFNPnrsv .Op Fl R Ar tagname +.Op Fl S Ar pidfile .Op Fl a Ar directory .Op Fl d Ar directory .Op Fl f Ar config_file @@ -246,6 +247,12 @@ Skipping the signal step will also mean that will return faster, since .Nm normally waits a few seconds after any signal that is sent. +.It Fl S Ar pidfile +Use +.Ar pidfile +as +.Xr syslogd 8 Ns 's +pidfile. .El .Pp If additional command line arguments are given, diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index f962482..7ba6cb8 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -206,6 +206,8 @@ char daytime[DAYTIME_LEN]; /* The current time in human readable form, * used for rotation-tracking messages. */ char hostname[MAXHOSTNAMELEN]; /* hostname */ +const char *path_syslogpid = _PATH_SYSLOGPID; + static struct cflist *get_worklist(char **files); static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, struct conf_entry *defconf_p, struct ilist *inclist); @@ -655,6 +657,9 @@ parse_args(int argc, char **argv) rotatereq++; requestor = strdup(optarg); break; + case 'S': + path_syslogpid = optarg; + break; case 'm': /* Used by OpenBSD for "monitor mode" */ default: usage(); @@ -747,7 +752,7 @@ usage(void) fprintf(stderr, "usage: newsyslog [-CFNnrsv] [-a directory] [-d directory] [-f config-file]\n" - " [-t timefmt ] [ [-R requestor] filename ... ]\n"); + " [-S pidfile] [-t timefmt ] [ [-R requestor] filename ... ]\n"); exit(1); } @@ -1355,7 +1360,7 @@ no_trimat: working->flags &= ~CE_SIGNALGROUP; } if (needroot) - working->pid_file = strdup(_PATH_SYSLOGPID); + working->pid_file = strdup(path_syslogpid); } /* diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index 125ced0..5ce1f40 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd November 27, 2006 +.Dd July 23, 2010 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -320,14 +320,17 @@ process ID or to find a group process ID if the flag was specified. If this field is present, a .Ar signal_number -is sent the process ID contained in this file. -If this field is not present, then a +is sent to the process ID contained in this file. +If this field is not present and the +.Cm N +flag has not been specified, then a .Dv SIGHUP signal will be sent to -.Xr syslogd 8 , -unless the -.Cm N -flag has been specified. +.Xr syslogd 8 +or to the process id found in the file specified by +.Xr newsyslog 8 Ns 's +.Fl S +switch. This field must start with .Ql / in order to be recognized properly. |