#! /bin/sh
#
# evms          Enterprise Volume Management System
#
# description:	Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#		Modified for EVMS package
#		by Matt Zimmerman <mdz@debian.org>
#		Modified for EVMS 2.0
#		by Kevin Corry <corryk@us.ibm.com>
#               Modified for Alt linux
#               Zhenja Kaluta <tren@altlinux.ru>
#		Grigory Milev <week@altlinux.ru>
#
# chkconfig: 2345 31 95

WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions

NAME=evms
DESC="Enterprise Volume Management System"

LOCKFILE=/var/lock/subsys/$NAME
RETVAL=0

[ -f /sbin/evms_activate ] || exit 1
[ -f /sbin/evms_deactivate ] || exit 1

set -e

case "$1" in
  start|reload|restart|condstart|condstop|condrestart|condreload)
	action "Starting $DESC: " evms_activate
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
	;;

  stop)
	action "Stopping $DESC: " evms_deactivate
	RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
	;;

  *)
	msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|status}"
        RETVAL=1
	;;
esac

exit $RETVAL
