mirror of https://github.com/fail2ban/fail2ban
Small fixes for Gentoo initd script
These fixes are pretty pedantic, but they do simplify the script a little. * Checking the existence of a file/directory before creating/deleting it adds complexity and raciness. There are better options. * mkdir -p does the job of making sure a directory exists. (It only fails if there's a filesystem error or something.) * Likewise, rm -f doesn't fail if the file doesn't exist. * rm -r isn't neccessary because the socket shouldn't be a directory. (If it is for some reason, that should be an error.)pull/1262/head
parent
fe8d585d91
commit
5b88a84fe8
|
@ -30,14 +30,10 @@ depend() {
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
ebegin "Starting fail2ban"
|
ebegin "Starting fail2ban"
|
||||||
if [ ! -d /var/run/fail2ban ]; then
|
mkdir -p /var/run/fail2ban || return 1
|
||||||
mkdir /var/run/fail2ban || return 1
|
# remove stalled sock file after system crash
|
||||||
fi
|
# bug 347477
|
||||||
if [ -e /var/run/fail2ban/fail2ban.sock ]; then
|
rm -f /var/run/fail2ban/fail2ban.sock || return 1
|
||||||
# remove stalled sock file after system crash
|
|
||||||
# bug 347477
|
|
||||||
rm -rf /var/run/fail2ban/fail2ban.sock || return 1
|
|
||||||
fi
|
|
||||||
${FAIL2BAN} start &> /dev/null
|
${FAIL2BAN} start &> /dev/null
|
||||||
eend $? "Failed to start fail2ban"
|
eend $? "Failed to start fail2ban"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue