Author: dnicholson
Date: 2007-04-16 15:46:35 -0600 (Mon, 16 Apr 2007)
New Revision: 8075
Modified:
trunk/bootscripts/ChangeLog
trunk/bootscripts/lfs/init.d/functions
trunk/bootscripts/lfs/init.d/sysklogd
Log:
Use pidofproc and respect pidfiles in reloadproc
Modified: trunk/bootscripts/ChangeLog
===================================================================
--- trunk/bootscripts/ChangeLog 2007-04-16 21:39:36 UTC (rev 8074)
+++ trunk/bootscripts/ChangeLog 2007-04-16 21:46:35 UTC (rev 8075)
@@ -14,6 +14,9 @@
is to parse the output. This changes statusproc() to return the
status of pidofproc(), which will return unsuccessfully if the
requested process is not running.
+ * lfs/init.d/functions: Changed reloadproc() to use pidofproc() and
+ respect the -p argument for pidfiles.
+ * lfs/init.d/sysklogd: Remove a useless argument to reloadproc().
2007-03-13 Dan Nicholson <[EMAIL PROTECTED]>
* lfs/init.d/functions: If pidofproc() is passed the -p argument
Modified: trunk/bootscripts/lfs/init.d/functions
===================================================================
--- trunk/bootscripts/lfs/init.d/functions 2007-04-16 21:39:36 UTC (rev
8074)
+++ trunk/bootscripts/lfs/init.d/functions 2007-04-16 21:46:35 UTC (rev
8075)
@@ -254,15 +254,44 @@
reloadproc()
{
- if [ "${#}" = "0" ]; then
- echo "Usage: reloadproc [{program}]"
- exit 1
+ local pidfile=""
+ local failure=0
+
+ while true
+ do
+ case "${1}" in
+ -p)
+ pidfile="${2}"
+ shift 2
+ ;;
+ -*)
+ log_failure_msg "Unknown Option: ${1}"
+ return 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" -lt "1" ]; then
+ log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
+ return 2
fi
- getpids "${1}"
+ # This will ensure compatibility with previous LFS Bootscripts
+ if [ -n "${PIDFILE}" ]; then
+ pidfile="${PIDFILE}"
+ fi
+ # Is the process running?
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
if [ -n "${pidlist}" ]; then
- failure="0"
for pid in ${pidlist}
do
kill -"${RELOADSIG}" "${pid}" || failure="1"
Modified: trunk/bootscripts/lfs/init.d/sysklogd
===================================================================
--- trunk/bootscripts/lfs/init.d/sysklogd 2007-04-16 21:39:36 UTC (rev
8074)
+++ trunk/bootscripts/lfs/init.d/sysklogd 2007-04-16 21:46:35 UTC (rev
8075)
@@ -34,7 +34,7 @@
reload)
boot_mesg "Reloading system log daemon config file..."
- reloadproc syslogd 1
+ reloadproc syslogd
;;
restart)
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page