aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2011-10-22 03:30:16 +0000
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2011-10-22 03:30:16 +0000
commit5cf7fc14966e52ffb054089b31c8c3bba2fbab85 (patch)
tree85c8d68a21a226c22c37a3bfe7bb6a552c8164bc
parent800f6ea0950a15c52f11933e0eebfcae30a576e8 (diff)
Fix statusproc in init-functions
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9640 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r--bootscripts/lfs/lib/services/init-functions24
1 files changed, 20 insertions, 4 deletions
diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions
index 4ba623adc..a9afb18a5 100644
--- a/bootscripts/lfs/lib/services/init-functions
+++ b/bootscripts/lfs/lib/services/init-functions
@@ -470,6 +470,8 @@ pidofproc()
# Inputs: -p pidfile, use the specified pidfile instead of pidof #
# pathname, path to the specified program #
# #
+# Note: Output to stdout. Not logged. #
+# #
# Return values: #
# 0 - Status printed #
# 1 - Input error. The daemon to check was not specified. #
@@ -481,8 +483,22 @@ statusproc()
exit 1
fi
- if [ -z "${PIDFILE}" ]; then
- pidlist=`pidofproc -p "${PIDFILE}" $@`
+ local 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
pidlist=`pidofproc $@`
fi
@@ -500,9 +516,9 @@ statusproc()
echo -e "${WARNING}${1} is not running but" \
"/var/run/${base}.pid exists.${NORMAL}"
else
- if [ -n "${PIDFILE}" -a -e "${PIDFILE}" ]; then
+ if [ -z "${pidlist}" -a -n "${pidfile}" ]; then
echo -e "${WARNING}${1} is not running" \
- "but ${PIDFILE} exists.${NORMAL}"
+ "but ${pidfile} exists.${NORMAL}"
else
echo -e "${INFO}${1} is not running.${NORMAL}"
fi