public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: master - init: merge qdisk init script into cman init Date: Fri, 20 Mar 2009 04:38:00 -0000 [thread overview] Message-ID: <20090320043745.A81801202F9@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ad1777fa1130213c32d44bdd5e6971068256418e Commit: ad1777fa1130213c32d44bdd5e6971068256418e Parent: 6f49af8ab3dc3b48d301011dcaa8fea43ef61f07 Author: Fabio M. Di Nitto <fdinitto@redhat.com> AuthorDate: Fri Mar 20 05:20:49 2009 +0100 Committer: Fabio M. Di Nitto <fdinitto@redhat.com> CommitterDate: Fri Mar 20 05:37:19 2009 +0100 init: merge qdisk init script into cman init Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> --- cman/init.d/Makefile | 19 ++----- cman/init.d/cman.in | 61 ++++++++++++++++-------- cman/init.d/qdiskd.in | 123 ------------------------------------------------- 3 files changed, 46 insertions(+), 157 deletions(-) diff --git a/cman/init.d/Makefile b/cman/init.d/Makefile index 554aa75..c7a226b 100644 --- a/cman/init.d/Makefile +++ b/cman/init.d/Makefile @@ -1,26 +1,19 @@ -TARGET1=cman -TARGET2=qdiskd +TARGET=cman -INITDT=$(TARGET1) $(TARGET2) +INITDT=$(TARGET) -all: $(TARGET1) $(TARGET2) +all: $(TARGET) include ../../make/defines.mk include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -$(TARGET1): $(S)/$(TARGET1).in - cat $(S)/$(TARGET1).in | sed \ +$(TARGET): $(S)/$(TARGET).in + cat $(S)/$(TARGET).in | sed \ -e 's#@SBINDIR@#${sbindir}#g' \ -e 's#@INITDDIR@#${initddir}#g' \ -e 's#@NOTIFYDDIR@#${notifyddir}#g' \ - > $(TARGET1) - -$(TARGET2): $(S)/$(TARGET2).in - cat $(S)/$(TARGET2).in | sed \ - -e 's#@SBINDIR@#${sbindir}#g' \ - -e 's#@INITDDIR@#${initddir}#g' \ - > $(TARGET2) + > $(TARGET) clean: generalclean diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in index 8b4c26a..42cc4e5 100644 --- a/cman/init.d/cman.in +++ b/cman/init.d/cman.in @@ -225,27 +225,10 @@ unfence_self() start_qdiskd() { - declare current_runlevel - - current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null) - # - # Start qdiskd before fenced to resolve bug #436381. This only - # happens if qdiskd is configured to run in the runlevel we are in - # - chkconfig --levels "$current_runlevel" qdiskd 2>/dev/null - if [ $? -ne 0 ]; then - # qdiskd doesn't start at this runlevel. - return 0 - fi - - echo -n " Starting qdiskd... " - service qdiskd start > /dev/null 2>&1 - if [ $? -eq 0 ] - then - echo "done" - else - echo "failed" - return 1 + status qdiskd > /dev/null 2>&1 + if [ $? -ne 0 ] && \ + ccs_tool query /cluster/quorumd >/dev/null 2>&1; then + errmsg=$( @SBINDIR@/qdiskd -Q 2>&1 ) || return 1 fi return 0 } @@ -490,7 +473,15 @@ start() return 1 fi + echo -n " Starting qdiskd... " start_qdiskd + if [ $? -eq 0 ] + then + echo "done" + else + echo "failed" + return 1 + fi echo -n " Starting daemons... " start_daemons @@ -577,6 +568,24 @@ stop_cmannotifyd() return 0 } +stop_qdiskd() +{ + retries=0 + + pid="$(pidof qdiskd)" + while [ -n "$pid" ] && [ $retries -lt 5 ]; do + kill $pid 2>&1 + sleep 1 + ((retries++)) + pid="$(pidof qdiskd)" + done + if [ -z "$(pidof qdiskd)" ]; then + return 0 + else + return 1 + fi +} + stop_fence() { if pidof fenced > /dev/null 2>&1 @@ -638,6 +647,16 @@ stop() return 1 fi + echo -n " Stopping the Quorum Disk Daemon: " + stop_qdiskd + if [ $? -eq 0 ] + then + echo "done" + else + echo "failed" + return 1 + fi + echo -n " Stopping cman... " if [ $1 ]; then stop_cman $1 diff --git a/cman/init.d/qdiskd.in b/cman/init.d/qdiskd.in deleted file mode 100644 index e40654e..0000000 --- a/cman/init.d/qdiskd.in +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# -# qdiskd quorum disk daemon -# -# chkconfig: - 22 78 -# description: Starts and stops the quorum disk daemon - -### BEGIN INIT INFO -# Provides: qdiskd -# Required-Start: cman -# Required-Stop: cman -# Default-Start: -# Default-Stop: -# Short-Description: start/stop quorum disk daemon -# Description: start/stop quorum disk daemon -### END INIT INFO - -# set secure PATH -PATH="/bin:/usr/bin:/sbin:/usr/sbin:@SBINDIR@" - -success() -{ - echo -ne "[ OK ]\r" -} - -failure() -{ - echo -ne "[FAILED]\r" -} - -status() -{ - pid=$(pidof $1 2>/dev/null) - rtrn=$? - if [ $rtrn -ne 0 ]; then - echo "$1 is stopped" - else - echo "$1 (pid $pid) is running..." - fi - return $rtrn -} - -# rpm based distros -if [ -d /etc/sysconfig ]; then - [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions - [ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster - [ -f /etc/sysconfig/qdiskd ] && . /etc/sysconfig/qdiskd - [ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/qdiskd" -fi - -# deb based distros -if [ -d /etc/default ]; then - [ -f /etc/default/cluster ] && . /etc/default/cluster - [ -f /etc/default/qdiskd ] && . /etc/default/qdiskd - [ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/qdiskd" -fi - -rtrn=1 -retries=0 - -# See how we were called. -case "$1" in - start) - echo -n "Starting the Quorum Disk Daemon: " - - status qdiskd >/dev/null - if [ $? -eq 0 ]; then - success - echo - exit 0 - fi - - @SBINDIR@/qdiskd -Q - rtrn=$? - if [ $rtrn = 0 ]; then - touch $LOCK_FILE - success - echo - else - failure - echo - fi - - ;; - - stop) - echo -n "Stopping the Quorum Disk Daemon: " - pid="$(pidof qdiskd)" - while [ -n "$pid" ] && [ $retries -lt 5 ]; do - kill $pid 2>&1 - sleep 1 - ((retries++)) - pid="$(pidof qdiskd)" - done - if [ -z "$(pidof qdiskd)" ]; then - success - echo - rtrn=0 - rm -f $LOCK_FILE - else - failure - echo - rtrn=1 - fi - ;; - - restart|reload) - $0 stop || exit $? - $0 start - rtrn=$? - ;; - - status) - status qdiskd - rtrn=$? - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - ;; -esac - -exit $rtrn
reply other threads:[~2009-03-20 4:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090320043745.A81801202F9@lists.fedorahosted.org \ --to=fabbione@fedoraproject.org \ --cc=cluster-cvs-relay@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).