#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the Samba smbd and nmbd daemons \
#	       used to provide SMB network services.

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that umd.conf exists.
[ -f /etc/umd.conf ] || exit 0

RETVAL=0

if test -d /opt/ACS
	then export PATH=$PATH:/opt/ACS/sbin
	else export PATH=$PATH:/usr/sbin:/usr/local/sbin
fi

# See how we were called.
case "$1" in
  start)
	echo -n "Starting umd server: "
	daemon umd -D 	
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/umd || \
	   RETVAL=1
	;;
  stop)
	echo -n "Shutting down umd server: "
	RETVAL=1
	if test ! -z "`pidof umd_pika`" ; then killproc umd_pika ; RETVAL=$? ; fi
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/umd
	;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  status)
	status umd
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL
