diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh index 5e85906..9a24836 100755 --- a/vendor/common/o2cb.init.sh +++ b/vendor/common/o2cb.init.sh @@ -17,24 +17,9 @@ # Force LC_ALL=C export LC_ALL=C +WITHOUT_RC_COMPAT=1 -if [ -f /etc/redhat-release ] -then -. /etc/init.d/functions - -start_daemon () { - daemon $* -} -else -# Let's try to use the LSB functions -. /lib/lsb/init-functions -fi - -if [ $? != 0 ] -then - echo "Unable to load LSB init functions" >&2 - exit 1 -fi +. /etc/rc.d/init.d/functions CLUSTERCONF=/etc/ocfs2/cluster.conf @@ -45,6 +30,8 @@ DLMFS_CAPABILITIES_FILE='/sys/module/ocfs2_dlmfs/parameters/capabilities' DLMFS_DIR="/dlm" DLMFS_MAGIC="76a9f425" DEBUGFS_DIR="/sys/kernel/debug" +PIDFILE=/var/run/o2cb/o2cb.pid +LOCKFILE=/var/lock/subsys/o2cb if [ -f /etc/sysconfig/o2cb ] then @@ -748,7 +735,7 @@ bringup_daemon() { 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 @@ -775,7 +762,7 @@ kill_daemon() PID="$(pidofproc "$DAEMON")" echo -n "Stopping $(basename "$DAEMON"): " - killproc "$DAEMON" $SIGNAL + stop_daemon "$DAEMON" -$SIGNAL --pidfile "$PIDFILE" --lockfile "$LOCKFILE" TRIED= while : @@ -1921,6 +1908,20 @@ case "$1" in start "$2" ;; + condstop) + $0 status + if test $? = 0; then + $0 stop + fi + ;; + + condrestart) + $0 status + if test $? = 0; then + $0 restart + fi + ;; + force-reload) stop "$2" start "$2" @@ -1981,7 +1982,7 @@ case "$1" in ;; *) - echo "Usage: $0 {start|stop|restart|force-reload|enable|disable|configure|load|unload|online|offline|force-offline|status|online-status}" + echo "Usage: $0 {start|stop|restart|force-reload|enable|disable|configure|load|unload|online|offline|force-offline|status|online-status|condstop|condrestart}" exit 1 ;; esac diff --git a/vendor/common/ocfs2.init b/vendor/common/ocfs2.init index a3bbdcc..b1f9b7e 100755 --- a/vendor/common/ocfs2.init +++ b/vendor/common/ocfs2.init @@ -16,10 +16,9 @@ # Short-Description: Mount OCFS2 volumes at boot. # Description: Mount OCFS2 volumes at boot. ### END INIT INFO +WITHOUT_RC_COMPAT=1 -if [ -f /etc/redhat-release ] -then -. /etc/init.d/functions +. /etc/rc.d/init.d/functions init_status() { @@ -28,68 +27,20 @@ init_status() 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() { @@ -172,8 +123,14 @@ case "$1" in $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