#! /bin/sh
#
# dictd          Start/Stop the dictd daemon.
#
# chkconfig: 2345 44 55
# description: dictionary daemon
# processname: dictd
# config: /etc/dictd.conf
# pidfile: /var/run/dictd.pid
. /etc/rc.d/init.d/functions

DAEMON=dictd
ARGS="--locale ru_RU.UTF-8"

start()
{
	echo -n "Starting $DAEMON daemon: "
	daemon $DAEMON $ARGS
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON
}

stop()
{
	echo -n "Stopping $DAEMON daemon: "
	killproc $DAEMON
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON
}

RETVAL=0

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status $DAEMON
	RETVAL=$?
	;;
  restart)
  	stop
	start
	;;
  reload)
  	stop
		start
	status $DAEMON
	RETVAL=$?
	;;
  condstart)
	if ! status $DAEMON &>/dev/null; then
		start
	fi
	;;
  condstop)
	if status $DAEMON &>/dev/null; then
		stop
	fi
	;;
  condrestart)
	if status $DAEMON &>/dev/null; then
		stop
		start
	fi
	;;
	condreload)                                                                                       
	if status $DAEMON &>/dev/null; then                                                         
		stop                                                                                
		start                                                                               
	fi                                                                                          
	;;
  *)
	echo "Usage: $DAEMON {start|stop|status|restart|reload|condstart|condstop|condrestart|condreload}"
	RETVAL=1
esac

exit $RETVAL
