#!/bin/sh
#
# chkconfig: - 91 9
# description: Starts and stops the dict server
# processname: dictd
# config: /etc/dictd.conf
# Source function library.
. /etc/rc.d/init.d/functions
DICTD=/usr/sbin/dictd
DICTD_FLAGS=
LOCKFILE=/var/lock/subsys/dictd
prog=dictd
[ -e /etc/sysconfig/dictd ] && . /etc/sysconfig/dictd
function start
{
unset RETVAL
if [ -x $DICTD ]; then
echo -n $"Starting $prog: "
if [ -s /etc/dictd.conf ]; then
daemon $DICTD $DICTD_FLAGS
echo
else
echo -n $"no dictionaries installed"
echo_failure
echo
RETVAL=1
fi
else
echo "$0: cannot find $DICTD or it's not executable"
fi
RETVAL=${RETVAL:-$?}
[ $RETVAL -eq 0 ] && touch $LOCKFILE
}
function stop
{
echo -n $"Shutting down $prog: "
killproc $prog
echo
rm -f $LOCKFILE
RETVAL=0
}
function restart
{
stop
start
}
# See how we were called.
case "$1" in
start) start
;;
stop) stop
;;
restart) restart
;;
condrestart)
RETVAL=0
test -f $LOCKFILE && restart
;;
status)
status dictd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
;;
esac
exit $RETVAL