#!/bin/sh
#
# chkconfig: 345 91 35
# description: Starts and stops the dict server

# Example script courtesy of Jeff Blain <jblaine@linus.mitre.org>
# Modified by Chris Ausbrooks <weed@bucket.pp.ualr.edu>

# 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 smb.conf exists.
[ -f /etc/smb.conf ] || exit 0

DICTD=/usr/sbin/dictd

if [ -f /etc/dictd.options ]; then
	DICTD_OPTIONS=`cat /etc/dictd.options`
else
	DICTD_OPTIONS=""
fi

# See how we were called.
case "$1" in
	start)
		if [ -x $DICTD ]; then
			echo -n "starting dict services: "
			daemon $DICTD $DICTD_OPTIONS
			echo
		else
			echo "$0: cannot find $DICTD or it's not executable"
		fi
	;;
	stop)
		echo -n "Shutting down dict services: "
		killproc dictd
		echo
	;;
	restart)
		$0 stop
		$0 start
	;;
	status)
		status dictd
	;;
	*)
		echo "Usage: $0 {start|stop|restart|status}"
		exit 1
	;;
esac
exit 0
