All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] multipath: update redhat multipathd init script
@ 2010-05-17 19:02 Benjamin Marzinski
  2010-05-18  2:24 ` Kiyoshi Ueda
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Marzinski @ 2010-05-17 19:02 UTC (permalink / raw)
  To: device-mapper development

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
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-18  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-17 19:02 [PATCH] multipath: update redhat multipathd init script Benjamin Marzinski
2010-05-18  2:24 ` Kiyoshi Ueda

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.