BF: account that now code 255 is the one to say "it is Ok, we are already running/stopped"

pull/2189/head
Yaroslav Halchenko 2018-07-24 12:42:52 -04:00
parent f323eceec7
commit 298f2c066a
1 changed files with 11 additions and 5 deletions

View File

@ -180,11 +180,17 @@ do_reload() {
#
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
log_end_msg $value
fi
exit $value
if [ $code != 0 ]; then
exit $1
fi
}
command="$1"
@ -192,13 +198,13 @@ case "$command" in
start|force-start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start "$command"
log_end_msg_wrapper $? 2 "$VERBOSE"
log_end_msg_wrapper $? 255 "$VERBOSE"
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
log_end_msg_wrapper $? 2 "$VERBOSE"
log_end_msg_wrapper $? 255 "$VERBOSE"
;;
restart|force-reload)
@ -207,7 +213,7 @@ case "$command" in
case "$?" in
0|1)
do_start
log_end_msg_wrapper $? 1 "always"
log_end_msg_wrapper $? 0 "always"
;;
*)
# Failed to stop