#!/bin/bash
#
#	/etc/rc.d/init.d/slpd
#
# Starts the at daemon
#
# chkconfig: 345 40 60
# description: OpenSLP daemon for the Service Location Protocol
# processname: slpd

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

test -x /usr/sbin/slpd || exit 0

RETVAL=0

#
#	See how we were called.
#
case "$1" in
  start)
	# Check if atd is already running
	if [ ! -f /var/lock/subsys/slpd ]; then
	    echo -n 'Starting slpd: '
	    daemon /usr/sbin/slpd
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/slpd
	    echo
	fi
	;;
  stop)
	echo -n 'Stopping slpd: '
	killproc /usr/sbin/slpd
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slpd
	echo
	;;
  reload|restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  status)
	status /usr/sbin/slpd
	RETVAL=$?
	;;
  *)
	echo "Usage: /etc/rc.d/init.d/slpd {start|stop|restart|reload|status}"
	exit 1
esac

exit $RETVAL
