read pid < "$pidfile"
if [ -n "${pid:-}" ]; then
if $(kill -0 "${pid:-}" 2> /dev/null); then
- echo "$pid"
+ echo "$pid" || true
return 0
elif ps "${pid:-}" >/dev/null 2>&1; then
- echo "$pid"
+ echo "$pid" || true
return 0 # program is running, but not owned by this user
else
return 1 # program is dead and /var/run pid file exists
if [ -z "${1:-}" ]; then
return 1
fi
- /bin/echo -n "$@"
+ /bin/echo -n "$@" || true
log_begin_msg_post "$@"
}
log_daemon_msg_pre "$@"
if [ -z "${2:-}" ]; then
- /bin/echo -n "$1:"
+ /bin/echo -n "$1:" || true
return
fi
- /bin/echo -n "$1: $2"
+ /bin/echo -n "$1: $2" || true
log_daemon_msg_post "$@"
}
if [ -z "${1:-}" ]; then
return 1
fi
- /bin/echo -n " $@"
+ /bin/echo -n " $@" || true
}
fi
if [ $1 -eq 0 ]; then
- echo "."
+ echo "." || true
elif [ $1 -eq 255 ]; then
- /bin/echo -e " ${YELLOW}(warning).${NORMAL}"
+ /bin/echo -e " ${YELLOW}(warning).${NORMAL}" || true
else
- /bin/echo -e " ${RED}failed!${NORMAL}"
+ /bin/echo -e " ${RED}failed!${NORMAL}" || true
fi
log_end_msg_post "$@"
return $retval
log_action_msg () {
log_action_msg_pre "$@"
- echo "$@."
+ echo "$@." || true
log_action_msg_post "$@"
}
log_action_begin_msg () {
log_action_begin_msg_pre "$@"
- /bin/echo -n "$@..."
+ /bin/echo -n "$@..." || true
log_action_begin_msg_post "$@"
}
log_action_cont_msg () {
- /bin/echo -n "$@..."
+ /bin/echo -n "$@..." || true
}
log_action_end_msg () {
fi
if [ $1 -eq 0 ]; then
- echo "done${end}"
+ echo "done${end}" || true
else
if log_use_fancy_output; then
RED=$( $TPUT setaf 1)
NORMAL=$( $TPUT op)
- /bin/echo -e "${RED}failed${end}${NORMAL}"
+ /bin/echo -e "${RED}failed${end}${NORMAL}" || true
else
- echo "failed${end}"
+ echo "failed${end}" || true
fi
fi
log_action_end_msg_post "$@"
# Default info blocks put to the left of the screen
log_daemon_msg_pre () {
if log_use_fancy_output; then
- /bin/echo -n "[....] "
+ /bin/echo -n "[....] " || true
fi
}
log_begin_msg_pre () {
YELLOW=$( $TPUT setaf 3)
NORMAL=$( $TPUT op)
- $TPUT civis
- $TPUT sc
- $TPUT hpa 0
+ $TPUT civis || true
+ $TPUT sc && \
+ $TPUT hpa 0 && \
if [ $1 -eq 0 ]; then
- /bin/echo -ne "[${GREEN} ok ${NORMAL}"
+ /bin/echo -ne "[${GREEN} ok ${NORMAL}" || true
elif [ $1 -eq 255 ]; then
- /bin/echo -ne "[${YELLOW}warn${NORMAL}"
+ /bin/echo -ne "[${YELLOW}warn${NORMAL}" || true
else
- /bin/echo -ne "[${RED}FAIL${NORMAL}"
- fi
- $TPUT rc
- $TPUT cnorm
+ /bin/echo -ne "[${RED}FAIL${NORMAL}" || true
+ fi && \
+ $TPUT rc || true
+ $TPUT cnorm || true
fi
}
log_action_msg_pre () {
if log_use_fancy_output; then
CYAN=$( $TPUT setaf 6)
NORMAL=$( $TPUT op)
- /bin/echo -ne "[${CYAN}info${NORMAL}] "
+ /bin/echo -ne "[${CYAN}info${NORMAL}] " || true
fi
}
log_action_begin_msg_pre () {
}
log_success_msg () {
- echo " * $@"
+ echo " * $@" || true
}
log_failure_msg () {
if log_use_fancy_output; then
RED=`$TPUT setaf 1`
NORMAL=`$TPUT op`
- echo " $RED*$NORMAL $@"
+ echo " $RED*$NORMAL $@" || true
else
- echo " * $@"
+ echo " * $@" || true
fi
}
if log_use_fancy_output; then
YELLOW=`$TPUT setaf 3`
NORMAL=`$TPUT op`
- echo " $YELLOW*$NORMAL $@"
+ echo " $YELLOW*$NORMAL $@" || true
else
- echo " * $@"
+ echo " * $@" || true
fi
}
# and we won't be able to reliably know where the colourful
# asterisk ought to go.
- printf " * $* "
+ printf " * $* " || true
# Enough trailing spaces for ` [fail]' to fit in; if the message
# is too long it wraps here rather than later, which is what we
# want.
- $TPUT hpa `$EXPR $COLS - 1`
- printf ' '
+ $TPUT hpa `$EXPR $COLS - 1` || true
+ printf ' ' || true
else
- echo " * $@"
+ echo " * $@" || true
COL=
fi
}
fi
fi
- printf "\r"
+ printf "\r" || true
$TPUT hpa $COL
if [ "$1" -eq 0 ]; then
- echo "[ OK ]"
+ echo "[ OK ]" || true
else
- printf '['
- $TPUT setaf 1 # red
- printf fail
- $TPUT op # normal
- echo ']'
+ printf '[' || true
+ $TPUT setaf 1 || true # red
+ printf fail || true
+ $TPUT op || true # normal
+ echo ']' || true
fi
else
if [ "$1" -eq 0 ]; then
- echo " ...done."
+ echo " ...done." || true
else
- echo " ...fail!"
+ echo " ...fail!" || true
fi
fi
return $1
}
log_action_msg () {
- echo " * $@"
+ echo " * $@" || true
}
log_action_begin_msg () {
- log_daemon_msg "$@..."
+ log_daemon_msg "$@..." || true
}
log_action_cont_msg () {
- log_daemon_msg "$@..."
+ log_daemon_msg "$@..." || true
}
log_action_end_msg () {