mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-19 03:39:20 +01:00
Fix statusproc in init-functions
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9640 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
800f6ea095
commit
5cf7fc1496
@ -470,6 +470,8 @@ pidofproc()
|
|||||||
# Inputs: -p pidfile, use the specified pidfile instead of pidof #
|
# Inputs: -p pidfile, use the specified pidfile instead of pidof #
|
||||||
# pathname, path to the specified program #
|
# pathname, path to the specified program #
|
||||||
# #
|
# #
|
||||||
|
# Note: Output to stdout. Not logged. #
|
||||||
|
# #
|
||||||
# Return values: #
|
# Return values: #
|
||||||
# 0 - Status printed #
|
# 0 - Status printed #
|
||||||
# 1 - Input error. The daemon to check was not specified. #
|
# 1 - Input error. The daemon to check was not specified. #
|
||||||
@ -481,8 +483,22 @@ statusproc()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PIDFILE}" ]; then
|
local pidfile
|
||||||
pidlist=`pidofproc -p "${PIDFILE}" $@`
|
local pidlist
|
||||||
|
|
||||||
|
# Process arguments
|
||||||
|
while true; do
|
||||||
|
case "${1}" in
|
||||||
|
|
||||||
|
-p)
|
||||||
|
pidfile="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "${pidfile}" ]; then
|
||||||
|
pidlist=`pidofproc -p "${pidfile}" $@`
|
||||||
else
|
else
|
||||||
pidlist=`pidofproc $@`
|
pidlist=`pidofproc $@`
|
||||||
fi
|
fi
|
||||||
@ -500,9 +516,9 @@ statusproc()
|
|||||||
echo -e "${WARNING}${1} is not running but" \
|
echo -e "${WARNING}${1} is not running but" \
|
||||||
"/var/run/${base}.pid exists.${NORMAL}"
|
"/var/run/${base}.pid exists.${NORMAL}"
|
||||||
else
|
else
|
||||||
if [ -n "${PIDFILE}" -a -e "${PIDFILE}" ]; then
|
if [ -z "${pidlist}" -a -n "${pidfile}" ]; then
|
||||||
echo -e "${WARNING}${1} is not running" \
|
echo -e "${WARNING}${1} is not running" \
|
||||||
"but ${PIDFILE} exists.${NORMAL}"
|
"but ${pidfile} exists.${NORMAL}"
|
||||||
else
|
else
|
||||||
echo -e "${INFO}${1} is not running.${NORMAL}"
|
echo -e "${INFO}${1} is not running.${NORMAL}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user