Add support for -P pid_file, like FreeBSD syslogd

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-29 13:54:36 +01:00
parent b67d57cf59
commit fc4840a698
2 changed files with 16 additions and 2 deletions

View File

@ -23,6 +23,9 @@ sysklogd \- Linux system logging utilities.
.I interval
]
.RB [ " \-n " ]
.RB [ " \-P "
.I pid file
]
.RB [ " \-p"
.IB socket
]
@ -154,6 +157,11 @@ Avoid auto-backgrounding. This is needed especially if the
is started and controlled by
.BR init (8).
.TP
.BI "\-P " "pid_file"
Specify an alternative file in which to store the process ID.
The default is
.IR /var/run/syslog.pid .
.TP
.BI "\-p " "socket"
You can specify an alternative unix domain socket instead of
.IR /dev/log "."

View File

@ -342,7 +342,7 @@ int main(int argc, char *argv[])
funix[i] = -1;
}
while ((ch = getopt(argc, argv, "46Aa:dhHf:l:m:np:R:rs:v?")) != EOF) {
while ((ch = getopt(argc, argv, "46Aa:dhHf:l:m:nP:p:R:rs:v?")) != EOF) {
switch ((char)ch) {
case '4':
family = PF_INET;
@ -396,6 +396,10 @@ int main(int argc, char *argv[])
Foreground = 1;
break;
case 'P':
PidFile = optarg;
break;
case 'p': /* path to regular log socket */
funixn[0] = optarg;
break;
@ -681,13 +685,15 @@ int usage(int code)
" -l HOST Host name to log without its FQDN, use ':' for multiple hosts\n"
" -m INTV Interval between MARK messages in log, 0 to disable, default: 20\n"
" -n Run in foreground, required when run from a modern init/supervisor\n"
" -P FILE Specify an alternative file in which to store the process ID.\n"
" The default is %s."
" -p PATH Alternate path to UNIX domain socket, default: %s\n"
" -r Act as remote syslog sink for other hosts\n"
" -s NAME Strip domain name before logging, use ':' for multiple domains\n"
" -v Show program version and exit\n"
"\n"
"Bug report address: %s\n",
_PATH_LOG, PACKAGE_BUGREPORT);
_PATH_LOGPID, _PATH_LOG, PACKAGE_BUGREPORT);
exit(code);
}