mirror of https://github.com/fail2ban/fail2ban
files/fail2ban-openrc.init: use a variable for the pid file location.
OpenRC has a special variable "pidfile" that should be used to store the location of the daemon's PID file. This commit replaces two instances of said location with one variable.pull/2182/head
parent
bc4a742e32
commit
115024d14a
|
@ -25,6 +25,7 @@ extra_started_commands="reload showlog"
|
|||
|
||||
command="/usr/bin/fail2ban-client"
|
||||
command_args="${FAIL2BAN_OPTIONS}"
|
||||
pidfile="/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"
|
||||
|
||||
depend() {
|
||||
use logger
|
||||
|
@ -37,14 +38,14 @@ start() {
|
|||
# remove stalled sock file after system crash
|
||||
# bug 347477
|
||||
rm -f /var/run/fail2ban/fail2ban.sock || return 1
|
||||
start-stop-daemon --start --pidfile /var/run/fail2ban/fail2ban.pid \
|
||||
start-stop-daemon --start --pidfile "${pidfile}" \
|
||||
-- ${command} ${command_args} start
|
||||
eend $? "Failed to start fail2ban"
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping fail2ban"
|
||||
start-stop-daemon --stop --pidfile /var/run/fail2ban/fail2ban.pid --retry 30 \
|
||||
start-stop-daemon --stop --pidfile "${pidfile}" --retry 30 \
|
||||
-- ${command} ${command_args} stop
|
||||
eend $? "Failed to stop fail2ban"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue