diff --git a/fail2ban/client/fail2bancmdline.py b/fail2ban/client/fail2bancmdline.py
index 1268ee9f..3c6bd0bf 100644
--- a/fail2ban/client/fail2bancmdline.py
+++ b/fail2ban/client/fail2bancmdline.py
@@ -97,6 +97,7 @@ class Fail2banCmdLine():
output(" -c
configuration directory")
output(" -s socket path")
output(" -p pidfile path")
+ output(" --pname name of the process (main thread) to identify instance (default fail2ban-server)")
output(" --loglevel logging level")
output(" --logtarget logging target, use file-name or stdout, stderr, syslog or sysout.")
output(" --syslogsocket auto|")
@@ -185,7 +186,7 @@ class Fail2banCmdLine():
try:
cmdOpts = 'hc:s:p:xfbdtviqV'
cmdLongOpts = ['loglevel=', 'logtarget=', 'syslogsocket=', 'test', 'async',
- 'timeout=', 'str2sec=', 'help', 'version', 'dp', '--dump-pretty']
+ 'pname=', 'timeout=', 'str2sec=', 'help', 'version', 'dp', '--dump-pretty']
optList, self._args = getopt.getopt(self._argv[1:], cmdOpts, cmdLongOpts)
except getopt.GetoptError:
self.dispUsage()
diff --git a/fail2ban/server/server.py b/fail2ban/server/server.py
index 7c820e49..22814280 100644
--- a/fail2ban/server/server.py
+++ b/fail2ban/server/server.py
@@ -80,8 +80,6 @@ class Server:
'Linux': '/dev/log',
}
self.__prev_signals = {}
- # replace real thread name with short process name (for top/ps/pstree or diagnostic):
- prctl_set_th_name('f2b/server')
def __sigTERMhandler(self, signum, frame): # pragma: no cover - indirect tested
logSys.debug("Caught signal %d. Exiting", signum)
@@ -112,6 +110,9 @@ class Server:
logSys.error(err)
raise ServerInitializationError(err)
# We are daemon.
+
+ # replace main thread (and process) name to identify server (for top/ps/pstree or diagnostic):
+ prctl_set_th_name(conf.get("pname", "fail2ban-server"))
# Set all logging parameters (or use default if not specified):
self.__verbose = conf.get("verbose", None)
diff --git a/man/fail2ban-client.1 b/man/fail2ban-client.1
index 9ea61084..32a90851 100644
--- a/man/fail2ban-client.1
+++ b/man/fail2ban-client.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
-.TH FAIL2BAN-CLIENT "1" "January 2020" "fail2ban-client v0.10.5" "User Commands"
+.TH FAIL2BAN-CLIENT "1" "February 2020" "fail2ban-client v0.10.5" "User Commands"
.SH NAME
fail2ban-client \- configure and control the server
.SH SYNOPSIS
@@ -19,6 +19,9 @@ socket path
\fB\-p\fR
pidfile path
.TP
+\fB\-\-pname\fR
+name of the process (main thread) to identify instance (default fail2ban\-server)
+.TP
\fB\-\-loglevel\fR
logging level
.TP
diff --git a/man/fail2ban-server.1 b/man/fail2ban-server.1
index ddf9b303..d75158a8 100644
--- a/man/fail2ban-server.1
+++ b/man/fail2ban-server.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
-.TH FAIL2BAN-SERVER "1" "January 2020" "fail2ban-server v0.10.5" "User Commands"
+.TH FAIL2BAN-SERVER "1" "February 2020" "fail2ban-server v0.10.5" "User Commands"
.SH NAME
fail2ban-server \- start the server
.SH SYNOPSIS
@@ -19,6 +19,9 @@ socket path
\fB\-p\fR
pidfile path
.TP
+\fB\-\-pname\fR
+name of the process (main thread) to identify instance (default fail2ban\-server)
+.TP
\fB\-\-loglevel\fR
logging level
.TP