#!/sbin/runscript # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ depend() { use logger need net before mta after pg_autovacuum postgresql mysql ldap } checkconfig() { if [ ! -f "/etc/mail/dspam/dspam.conf" ] then eerror "You need a DSPAM configuration in /etc/mail/dspam/dspam.conf" return 1 fi } start() { checkconfig || return 1 ebegin "Starting DSPAM" start-stop-daemon --start --quiet --background \ --exec /usr/bin/dspam -- --daemon --debug eend ${?} } stop() { checkconfig || return 1 local include_conf="$(sed -n "s:^Include[\t ]*[\"']\{0,1\}\([^\"']*\).*:\1:gp" /etc/mail/dspam/dspam.conf)" local DSPAM_PID="$(sed -n "s:^ServerPID[\t ]*[\"']\{0,1\}\([^\"']*\).*:\1:gp" /etc/mail/dspam/dspam.conf ${include_conf[@]}|sed q)" if [ -z "${DSPAM_PID}" -a -f "/var/run/dspam/dspam.pid" ]; then DSPAM_PID="/var/run/dspam/dspam.pid" fi ebegin "Stopping DSPAM" if [ -n "${DSPAM_PID}" -a -f "${DSPAM_PID}" ]; then start-stop-daemon --stop --quiet --pidfile ${DSPAM_PID} eend ${?} else eend 1 "Could not stop DSPAM. No PID file!" fi }