diff -ur ocfs2-tools/vendor/common/o2cb.init.sh ocfs2-tools.new/vendor/common/o2cb.init.sh --- ocfs2-tools/vendor/common/o2cb.init.sh 2008-08-08 20:50:04 +0400 +++ ocfs2-tools.new/vendor/common/o2cb.init.sh 2008-08-08 20:55:20 +0400 @@ -1030,8 +1030,22 @@ stop ;; + condstop) + $0 status + if test $? = 0; then + $0 stop + fi + ;; + + condrestart) + $0 status + if test $? = 0; then + $0 restart + fi + ;; + *) - echo "Usage: $0 {start|stop|restart|force-reload|enable|disable|configure|load|unload|online|offline|force-offline|status}" + echo "Usage: $0 {start|stop|restart|force-reload|enable|disable|configure|load|unload|online|offline|force-offline|status|condstop|condrestart}" exit 1 ;; esac diff -ur ocfs2-tools/vendor/common/ocfs2.init ocfs2-tools.new/vendor/common/ocfs2.init --- ocfs2-tools/vendor/common/ocfs2.init 2008-08-08 20:50:04 +0400 +++ ocfs2-tools.new/vendor/common/ocfs2.init 2008-08-08 20:53:04 +0400 @@ -16,8 +16,6 @@ # Description: Mount OCFS2 volumes at boot. ### END INIT INFO -if [ -f /etc/redhat-release ] -then . /etc/init.d/functions init_status() @@ -27,68 +25,20 @@ success_status() { - success - echo -} - -failure_status() -{ - failure $1 - echo -} - -exit_status() -{ - exit $? -} -elif [ -f /etc/SuSE-release -o -f /etc/UnitedLinux-release ] -then -. /etc/rc.status - -init_status() -{ - rc_reset -} - -success_status() -{ - /bin/true - rc_status -v -} - -failure_status() -{ - /bin/false - rc_status -v -} - -exit_status() -{ - rc_exit -} -else -init_status() -{ - return 0 -} - -success_status() -{ - echo "OK" + success "ocfs2 ok" return 0 } failure_status() { - echo "Failed" - return 0 + failure "ocfs2 failure" + return 1 } exit_status() { exit $? } -fi ocfs2mounts() { @@ -171,8 +121,14 @@ $0 restart fi ;; + condstop) + $0 status + if test $? = 0; then + $0 stop + fi + ;; *) - echo "Usage: $0 {start|stop|status|reload|force-reload|restart|try-restart}" + echo "Usage: $0 {start|stop|condstop|status|reload|force-reload|restart|try-restart|condrestart}" exit 1 esac diff -ur ocfs2-tools/vendor/common/o2cb.init.sh ocfs2-tools.new/vendor/common/o2cb.init.sh --- ocfs2-tools/vendor/common/o2cb.init.sh 2008-07-22 02:44:25 +0400 +++ ocfs2-tools.new/vendor/common/o2cb.init.sh 2008-09-23 15:27:54 +0400 @@ -31,6 +31,8 @@ OCFS2_SYS_DIR="/sys/fs/ocfs2" LOADED_PLUGINS_FILE="${OCFS2_SYS_DIR}/loaded_cluster_plugins" CLUSTER_STACK_FILE="${OCFS2_SYS_DIR}/cluster_stack" +PIDFILE=/var/run/o2cb/o2cb.pid +LOCKFILE=/var/lock/subsys/o2cb if [ -f /etc/sysconfig/o2cb ] then @@ -669,7 +671,7 @@ { DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}" echo -n "Starting $(basename "$DAEMON"): " - start_daemon "$DAEMON" + start_daemon "$DAEMON" --pidfile "$PIDFILE" --lockfile "$LOCKFILE" [ $? != 0 ] && return 1 COUNT=0 @@ -696,7 +698,7 @@ PID="$(pidofproc "$DAEMON")" echo -n "Stopping $(basename "$DAEMON"): " - killproc "$DAEMON" $SIGNAL + stop_daemon "$DAEMON" -$SIGNAL --pidfile "$PIDFILE" --lockfile "$LOCKFILE" TRIED= while : diff -ur ocfs2-tools/vendor/common/o2cb.init.sh ocfs2-tools.new/vendor/common/o2cb.init.sh --- ocfs2-tools/vendor/common/o2cb.init.sh 2008-07-22 02:44:25 +0400 +++ ocfs2-tools.new/vendor/common/o2cb.init.sh 2008-10-08 02:53:43 +0400 @@ -18,13 +18,7 @@ # Force LC_ALL=C export LC_ALL=C -# Let's try to use the LSB functions -. /lib/lsb/init-functions -if [ $? != 0 ] -then - echo "Unable to load LSB init functions" >&2 - exit 1 -fi +. /etc/init.d/functions CLUSTERCONF=/etc/ocfs2/cluster.conf