mirror of https://github.com/fail2ban/fail2ban
files/fail2ban-openrc.init: move pre-flight checks into start_pre().
Our OpenRC service script performs two tasks before starting the service: 1. It removes any stake sockets (from e.g. a system crash). 2. It ensures that the PID file directory exists. These have both been moved into the "start_pre" phase, which is designed to do such things (and will allow us to simplify the "start" phase in the future). The existing "mkdir -p" has also been converted into a "checkpath -d" command which is built-in to OpenRC.pull/2182/head
parent
115024d14a
commit
0b146208eb
|
@ -32,12 +32,16 @@ depend() {
|
||||||
after iptables
|
after iptables
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
checkpath -d "${pidfile%/*}" || return 1
|
||||||
|
|
||||||
|
# Remove stale socket after system crash, Gentoo bug 347477
|
||||||
|
rm -f /var/run/fail2ban/fail2ban.sock || return 1
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
ebegin "Starting fail2ban"
|
ebegin "Starting fail2ban"
|
||||||
mkdir -p /var/run/fail2ban || return 1
|
|
||||||
# remove stalled sock file after system crash
|
|
||||||
# bug 347477
|
|
||||||
rm -f /var/run/fail2ban/fail2ban.sock || return 1
|
|
||||||
start-stop-daemon --start --pidfile "${pidfile}" \
|
start-stop-daemon --start --pidfile "${pidfile}" \
|
||||||
-- ${command} ${command_args} start
|
-- ${command} ${command_args} start
|
||||||
eend $? "Failed to start fail2ban"
|
eend $? "Failed to start fail2ban"
|
||||||
|
|
Loading…
Reference in New Issue