#
# chkconfig: 345 90 10
# description: This is a daemon for the Dictionary Server Protocol (DICT), \
-# a TCP transaction based query/response protocol that allows \
-# a client to access dictionary definitions from a set of \
+# a TCP transaction based query/response protocol that allows \
+# a client to access dictionary definitions from a set of \
# natural language dictionary databases.
# processname: dictd
# config: /etc/dictd.conf
+# config: /etc/dictd/*
DAEMON_FILE=dictd
-DAEMON_NAME="Dictionary Daemon"
+DAEMON_NAME="Dictionary Daemon"
+DAEMON_CONF=/etc/dictd.conf
-# Sanity checks.
-[ -f /etc/${DAEMON_FILE}.conf ] || exit 0
-[ -x /usr/sbin/${DAEMON_FILE} ] || exit 0
+generate_dictdconf() {
+ umask 022
+ if ls /etc/dictd/*.dictconf >/dev/null 2>&1; then
+ echo "# DO NOT EDIT! This file is autogenerated by $0." >$DAEMON_CONF
+ echo "# To configure dictd edit /etc/dictd/* files and restart daemon"\
+ >>$DAEMON_CONF
+ cat /etc/dictd/dictd-main.conf /etc/dictd/*.dictconf >>$DAEMON_CONF
+ return 0
+ fi
+
+ echo "$0: $(nls 'no dictionaries found')"
+ return 1
+}
# Source function library.
. /etc/rc.d/init.d/functions
# Get network config
. /etc/sysconfig/network
-if is_no "${NETWORKING}"; then
- msg_Network_Down ${DAEMON_FILE}
- exit 1
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down ${DAEMON_FILE}
+ exit 1
+ fi
+else
+ exit 0
fi
# Get sysconfig
RETVAL=0
# See how we were called.
case "$1" in
- start)
+ start)
+ [ -x /usr/sbin/${DAEMON_FILE} ] || exit 0
if [ ! -f /var/lock/subsys/${DAEMON_FILE} ]; then
- msg_starting ${DAEMON_NAME}
- daemon ${DAEMON_FILE} ${DICTD_OPTS}
- pidofproc ${DAEMON_FILE} >/dev/null 2>&1
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${DAEMON_FILE}
+ if generate_dictdconf; then
+ msg_starting ${DAEMON_NAME}
+ daemon ${DAEMON_FILE} ${DICTD_OPTS}
+ pidofproc ${DAEMON_FILE} >/dev/null 2>&1
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && \
+ touch /var/lock/subsys/${DAEMON_FILE}
+ else
+ exit 1
+ fi
else
- msg_Already_Running ${DAEMON_NAME}
- exit 1
+ msg_already_running ${DAEMON_NAME}
fi
- ;;
- stop)
+ ;;
+ stop)
if [ -f /var/lock/subsys/${DAEMON_FILE} ]; then
msg_stopping ${DAEMON_NAME}
- busy
- killproc /usr/sbin/${DAEMON_FILE}
+ killproc /usr/sbin/${DAEMON_FILE}
rm -f /var/lock/subsys/${DAEMON_FILE} >/dev/null 2>&1
else
- msg_Not_Running ${DAEMON_NAME}
- exit 1
- fi
+ msg_not_running ${DAEMON_NAME}
+ fi
;;
status)
- status ${DAEMON_FILE}
- ;;
- restart|reload)
- $0 stop
- $0 start
- ;;
- *)
- msg_Usage "$0 {start|stop|status|restart|reload}"
- exit 1
+ status ${DAEMON_FILE}
+ exit $?
;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
esac
exit $RETVAL