#!/bin/bash # # chkconfig: - 22 78 # description: Starts and stops the quroum disk daemon # # ### BEGIN INIT INFO # Provides: ### END INIT INFO . /etc/init.d/functions [ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster LOCK_FILE="/var/lock/subsys/qdiskd" 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 echo_success echo exit 0 fi qdiskd -Q rtrn=$? if [ $rtrn = 0 ]; then touch $LOCK_FILE echo_success echo else echo_failure echo fi ;; stop) echo -n "Stopping the Quorum Disk Daemon:" killproc qdiskd while [ -n "`pidof qdiskd`" ] && [ $retries -lt 5 ]; do sleep 1 killproc qdiskd ((retries++)) done if [ -z "`pidof qdiskd`" ]; then echo_success echo rtrn=0 rm -f $LOCK_FILE else echo_failure echo rtrn=1 fi ;; restart) $0 stop || exit $? $0 start rtrn=$? ;; status) status qdiskd rtrn=$? ;; *) echo $"Usage: $0 {start|stop|restart|status}" ;; esac exit $rtrn