#!/bin/sh
#
# gfs_controld - GFS2 cluster filesystem daemon
#
# chkconfig: - 23 76
# description: Starts and stops gfs_controld for dlm based GFS2 filesystems
#


### BEGIN INIT INFO
# Provides: gfs_controld
# Required-Start: $network cman
# Required-Stop: $network cman
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Starts and stops gfs_controld
# Description: Starts and stops gfs_controld for dlm based GFS2 filesystems
### END INIT INFO

. /etc/rc.d/init.d/functions

prog="gfs_controld"
lockfile="/var/lock/subsys/$prog"
exec="/usr/sbin/$prog"

start() {
	[ -x $exec ] || exit 5
	echo -n $"Starting $prog: "
	daemon $prog
	retval=$?
	echo
	[ $retval -eq 0 ] && touch $lockfile
	return $retval
}

stop() {
	echo -n $"Stopping $prog: "
	killproc $prog
	retval=$?
	echo
	[ $retval -eq 0 ] && rm -f $lockfile
}

restart() {
	stop
	start
}

reload() {
	restart
}

rh_status() {
	status $prog
}

rh_status_q() {
	rh_status >/dev/null 2>&1
}

case "$1" in
	start)
		rh_status_q && exit 0
		$1
		;;
	stop)
		rh_status_q || exit 0
		$1
		;;
	restart)
		$1
		;;
	reload)
		rh_status_q || exit 7
		$1
		;;
	force-reload)
		force_reload
		;;
	status)
		rh_status
		;;
	condrestart|try-restart)
		rh_status_q || exit 0
		restart
		;;
	*)
		echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
		exit 2
esac
exit $?

