#!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/mail-mta/yacsd/files/yacsd.rc6.2.2.9,v 1.1 2006/03/07 21:07:20 ferdy Exp $ opts="${opts} configtest reload" YACSD="${YACSD:-/usr/bin/yacsd}" PIDFILE="${PIDFILE:-/var/run/yacsd.pid}" YACSD_OPTS="${YACSD_OPTS:---config=/etc/yacs-0.6/yacsd.conf --pidfile=${PIDFILE}}" depend() { need logger dns net mysql } checkconfig() { ${YACSD} ${YACSD_OPTS} -t ret=$? if [ $ret -ne 0 ]; then eerror "yacsd has detected an error in configuration files." fi return $ret } configtest() { ebegin "Checking yacsd Configuration" checkconfig eend $? } start() { checkconfig || return $? ebegin "Starting yacsd" ${YACSD} ${YACSD_OPTS} &>/dev/null eend $? } stop() { pid=$(cat ${PIDFILE}) ebegin "Stopping yacsd (pid=${pid})" kill -TERM ${pid} for i in `seq 10`; do ps -C yacsd -o pid= | grep -q ${pid} && break sleep 1 done ps -C yacsd -o pid= | grep -q ${pid} eend $? } reload() { ebegin "Reloading yacsd" kill -HUP $(cat ${PIDFILE}) eend $? }