case statement changes to
case "${retval}" in
0) ;; # Program is running correctly
1) # Program is not running, but an invalid pid file exists
# Remove the pid file.
# If a PID file exists with that name, assume that is it.
[ -z "${pidfile}" ] && pidfile="${program##*/}"
[ -e "/run/${pidfile}" ] && rm -f "/run/${pidfile}" 2>
/dev/null
[ -e "/run/${pidfile}.pid" ] && rm -f "/run/${pidfile}.pid"
2> /dev/null
# This is only a success if no signal was passed.
if [ -n "${nosig}" ]; then
return 0
else
return 7
fi
;;
3) # Program is not running and no pidfile exists
# This is only a success if no signal was passed.
if [[ -n "${nosig}" ]]; then return 0; else return 7; fi
;;
*) return 1 ;;
esac
Add this to at the bottom of the function to fix
# Check for and remove stale PID files.
if ! kill -0 "${pid}" 2> /dev/null; then
[ -z "${pidfile}" ] && pidfile="${program##*/}"
[ -e "/run/${pidfile}" ] && rm -f "/run/${pidfile}" 2> /dev/null
[ -e "/run/${pidfile}.pid" ] && rm -f "/run/${pidfile}.pid" 2>
/dev/null
fi
return 0
}
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
Do not top post on this list.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
http://en.wikipedia.org/wiki/Posting_style