Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 300db2b7e3a71bdac3953aa314d868ca > files > 1

dictd-server-1.5.5-2mdk.i586.rpm

#!/bin/sh
#
# chkconfig: 345 91 9
# description: Starts and stops the dict server
# processname: dictd
# config: /etc/dictd.conf

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

[ -f /etc/dictd.conf ] || exit 0


DICTD=/usr/sbin/dictd
DICTD_FLAGS=
LOCKFILE=/var/lock/subsys/dictd-server

[ -e /etc/sysconfig/dictd ] && . /etc/sysconfig/dictd

function start
{
    if [ -x $DICTD ]; then
	gprintf "starting dict services: "
	daemon $DICTD $DICTD_FLAGS
	echo
    else
	gprintf "%s: cannot find %s or it's not executable\n" "$0" "$DICTD"
    fi

    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch $LOCKFILE
}

function stop
{
    gprintf "Shutting down dict services: "
    killproc dictd
    echo
    rm -f $LOCKFILE

    RETVAL=0
}

function restart
{
    stop
    start
}

function reload
{
    test -f $LOCKFILE && restart
    RETVAL=0
}

function f_status
{
    status dictd
    RETVAL=$?
}

function usage
{
    gprintf "Usage: %s {start|stop|restart|condrestart|reload|status}\n" "$0"
    exit 1
}

# See how we were called.
case "$1" in
    start)		start;;
    stop)		stop;;
    restart)		restart;;
    condrestart|reload)	reload;;
    status)		f_status;;
	
    *)			usage;;
esac

exit $RETVAL