mirror of https://github.com/fail2ban/fail2ban
BF: account that now code 255 is the one to say "it is Ok, we are already running/stopped"
parent
f323eceec7
commit
298f2c066a
|
@ -180,11 +180,17 @@ do_reload() {
|
||||||
#
|
#
|
||||||
log_end_msg_wrapper()
|
log_end_msg_wrapper()
|
||||||
{
|
{
|
||||||
[ $1 -lt $2 ] && value=0 || value=1
|
if [ $1 != 0 ] && [ $1 != $2 ]; then
|
||||||
|
value=1
|
||||||
|
else
|
||||||
|
value=0
|
||||||
|
fi
|
||||||
if [ "$3" != "no" ]; then
|
if [ "$3" != "no" ]; then
|
||||||
log_end_msg $value
|
log_end_msg $value
|
||||||
fi
|
fi
|
||||||
exit $value
|
if [ $code != 0 ]; then
|
||||||
|
exit $1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
command="$1"
|
command="$1"
|
||||||
|
@ -192,13 +198,13 @@ case "$command" in
|
||||||
start|force-start)
|
start|force-start)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
do_start "$command"
|
do_start "$command"
|
||||||
log_end_msg_wrapper $? 2 "$VERBOSE"
|
log_end_msg_wrapper $? 255 "$VERBOSE"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
do_stop
|
do_stop
|
||||||
log_end_msg_wrapper $? 2 "$VERBOSE"
|
log_end_msg_wrapper $? 255 "$VERBOSE"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
|
@ -207,7 +213,7 @@ case "$command" in
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0|1)
|
0|1)
|
||||||
do_start
|
do_start
|
||||||
log_end_msg_wrapper $? 1 "always"
|
log_end_msg_wrapper $? 0 "always"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Failed to stop
|
# Failed to stop
|
||||||
|
|
Loading…
Reference in New Issue