All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] multipath: update redhat multipathd init script
Date: Mon, 17 May 2010 14:02:47 -0500	[thread overview]
Message-ID: <20100517190247.GN3295@ether.msp.redhat.com> (raw)

This patch adds the requested force-stop and force-restart to the init
script. It also keeps the init script for printing annoying error messages,
while checking the root device.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/multipathd.init.redhat |   37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

Index: multipath-tools-100510/multipathd/multipathd.init.redhat
===================================================================
--- multipath-tools-100510.orig/multipathd/multipathd.init.redhat
+++ multipath-tools-100510/multipathd/multipathd.init.redhat
@@ -7,6 +7,10 @@
 
 ### BEGIN INIT INFO
 # Provides: multipathd
+# Required-Start:
+# Required-Stop:
+# Default-Start:
+# Default-Stop:
 # Short-Description: Control multipathd
 # Description: This service monitors and manages
 #              device-mapper multipath devices
@@ -69,12 +73,7 @@ start() {
 	echo
 }
 
-stop() {
-        root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
-	dm_num=`dmsetup info -c --noheadings -o minor $root_dev`
-	root_dm_device="dm-$dm_num"
-	[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
-
+force_stop() {
 	echo -n $"Stopping $prog daemon: "
 	killproc $DAEMON
 	RETVAL=$?
@@ -82,10 +81,26 @@ stop() {
 	echo
 }
 
+stop() {
+        root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
+	dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
+	if [ $? -eq 0 ]; then
+		root_dm_device="dm-$dm_num"
+		[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
+	fi
+
+	force_stop
+}
+
 restart() {
 	stop
 	start
-}	
+}
+
+force_restart() {
+	force_stop
+	start
+}
 
 reload() {
 	echo -n "Reloading $prog: "
@@ -102,12 +117,18 @@ start)
 stop)
 	stop
 	;;
+force-stop)
+	force_stop
+	;;
 force-reload|reload)
 	reload
 	;;
 restart)
 	restart
 	;;
+force-restart)
+	force_restart
+	;;
 condrestart|try-restart)
 	if [ -f $lockdir/$prog ]; then
 	    restart
@@ -118,7 +139,7 @@ status)
 	RETVAL=$?
 	;;
 *)
-	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+	echo $"Usage: $0 {start|stop|force-stop|status|restart|force-restart|condrestart|reload}"
 	RETVAL=2
 esac
 

             reply	other threads:[~2010-05-17 19:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 19:02 Benjamin Marzinski [this message]
2010-05-18  2:24 ` [PATCH] multipath: update redhat multipathd init script Kiyoshi Ueda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100517190247.GN3295@ether.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.