]> sourceware.org Git - lvm2.git/commitdiff
Initial version of the cmirrord init script
authorJonathan Earl Brassow <jbrassow@redhat.com>
Fri, 15 Jan 2010 20:47:52 +0000 (20:47 +0000)
committerJonathan Earl Brassow <jbrassow@redhat.com>
Fri, 15 Jan 2010 20:47:52 +0000 (20:47 +0000)
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
WHATS_NEW
scripts/cmirrord_init_red_hat.in [new file with mode: 0755]

index e38722a62aa5a6c97108bb627aa9313f5c5733f5..c9f3fd4ed0a2bda0148a95e762db675ff425449a 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.59 - 
 ===================================
+  Initial version of the cmirror init script (Red Hat).
   Initial version of the cmirrord man page.
   Make cluster log communication structures architecture independant.
   Fix cluster log issues with in-memory bitmaps.
diff --git a/scripts/cmirrord_init_red_hat.in b/scripts/cmirrord_init_red_hat.in
new file mode 100755 (executable)
index 0000000..025814d
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/bash
+#
+# chkconfig: - 22 78
+# description: Loads/Unloads dm-log-clustered module
+#
+#
+### BEGIN INIT INFO
+# Provides: cmirrord
+# Required-Start:       $network $time
+# Required-Stop:        $network $time
+# Short-Description:    Starts and stops cmirrord
+# Description:          Starts and stops the cluster mirror log daemon
+### END INIT INFO
+
+. /etc/init.d/functions
+
+# set secure PATH
+PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin"
+
+start()
+{
+        echo -n "Starting clustered mirror log server:"
+       ps -C cmirrord >& /dev/null || cmirrord >& /dev/null
+
+       rtrn=$?
+        if [ $rtrn -eq 0 ]; then
+                success "startup"
+        else
+                failure "startup"
+        fi
+
+        # need the extra echo to properly terminate the line
+        echo
+        return $rtrn
+}
+
+stop()
+{
+        echo -n "Stopping clustered mirror log server:"
+       killall cmirrord >& /dev/null
+       for ((i=0; $i < 10; i++)); do
+           if ! ps -C cmirrord >& /dev/null; then
+               break;
+           fi
+           sleep 1
+       done
+
+       if [ $i -ge 10 ]; then
+           failure "shutdown"
+           echo
+           return 1
+       else
+           success "shutdown"
+       fi
+
+       echo
+        return $rtrn
+}
+
+cmirror_status()
+{
+       ps -C cmirrord >& /dev/null
+       if [ $? -ne 0 ]; then
+               echo "Cluster log server is not running.  (Cluster mirrors will not work.)"
+               return 1
+       fi
+
+       return 0
+}
+
+rtrn=1
+
+# See how we were called.
+case "$1" in
+  start)
+        start
+        rtrn=$?
+        ;;
+
+  stop)
+        stop
+        rtrn=$?
+        ;;
+
+  restart)
+        $0 stop
+        $0 start
+        rtrn=$?
+        ;;
+
+  status)
+       cmirror_status
+        rtrn=$?
+       if [ $rtrn -eq 0 ]; then
+               echo "cmirror is running."
+       fi
+        ;;
+
+  *)
+        echo $"Usage: $0 {start|stop|restart|status}"
+        ;;
+esac
+
+exit $rtrn
This page took 0.068854 seconds and 5 git commands to generate.