#! /bin/sh
### BEGIN INIT INFO
# Provides:          sipb-xen-clvm-config
# Required-Start:    $ccs $cman
# Required-Stop:
# Should-Start:      $network
# Default-Start:     S
# Default-Stop:
# Short-Description: Start clvm daemon
# Description:       Network file systems are mounted by
#                    /etc/network/if-up.d/mountnfs in the background
#                    when interfaces are brought up; this script waits
#                    for them to be mounted before carrying on.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/clvmd
NAME=sipb-xen-clvm-config
PIDFILE=/var/run/cluster/clvmd.pid
DESC="Cluster LVM"

test -x $DAEMON || exit 0

CLVMD_OPTIONS=""

if [ -f /etc/default/sipb-xen-clvm-config ] ; then
	. /etc/default/sipb-xen-clvm-config
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $CLVMD_OPTIONS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE --exec $DAEMON
	echo "$NAME."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: "
	$0 stop
	sleep 1
	$0 start
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
