mirror of https://github.com/fail2ban/fail2ban
fixed status command. now rely on presence of socket to be a bit more verbose
parent
a45fadd183
commit
9851383362
|
@ -19,8 +19,11 @@
|
||||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
DESC="authentication failure monitor"
|
DESC="authentication failure monitor"
|
||||||
NAME=fail2ban
|
NAME=fail2ban
|
||||||
|
|
||||||
|
# fail2ban-client is not a daemon itself but starts a daemon and
|
||||||
|
# loads its with configuration
|
||||||
DAEMON=/usr/bin/$NAME-client
|
DAEMON=/usr/bin/$NAME-client
|
||||||
PIDFILE=/var/run/$NAME.pid
|
SOCKFILE=/tmp/$NAME.sock
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
# Exit if the package is not installed
|
# Exit if the package is not installed
|
||||||
|
@ -117,20 +120,24 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
log_daemon_msg "Status of $DESC"
|
log_daemon_msg "Status of $DESC"
|
||||||
pidofproc $NAME $PIDFILE > /dev/null
|
$DAEMON status > /dev/null
|
||||||
status=$?
|
case $? in
|
||||||
case $status in
|
|
||||||
0) log_success_msg " $NAME is running"
|
0) log_success_msg " $NAME is running"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
1|2) log_failure_msg " $NAME is not running but $PIDFILE exists"
|
255)
|
||||||
exit 1
|
if [ -S $SOCKFILE ]; then
|
||||||
;;
|
if [ -r $SOCKFILE ]; then
|
||||||
3) log_warning_msg " $NAME is not running"
|
log_failure_msg " $NAME is not running but $SOCKFILE exists"
|
||||||
exit 3
|
exit 1
|
||||||
;;
|
else
|
||||||
4) log_failure_msg " $PIDFILE not readable, status of $NAME unknown"
|
log_failure_msg " $SOCKFILE not readable, status of $NAME unknown"
|
||||||
exit 4
|
exit 4
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_warning_msg " $NAME is not running"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue