#!/sbin/runscript # Copyright 1999-2009 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() { local include_conf="" if [ ! -f "/etc/mail/dspam/dspam.conf" ] then eerror "You need a DSPAM configuration in /etc/mail/dspam/dspam.conf" return 1 fi include_conf="$(sed -n "s:^Include[\t ]*[\"']\{0,1\}\([^\"']*\).*:\1:gp" /etc/mail/dspam/dspam.conf)" if ( ! grep -q "^ServerPID" /etc/mail/dspam/dspam.conf ${include_conf[@]}) then eerror "ServerPID missing in DSPAM configuration /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="" local DSPAM_PID="" include_conf="$(sed -n "s:^Include[\t ]*[\"']\{0,1\}\([^\"']*\).*:\1:gp" /etc/mail/dspam/dspam.conf)" DSPAM_PID="$(sed -n "s:^ServerPID[\t ]*[\"']\{0,1\}\([^\"']*\).*:\1:gp" /etc/mail/dspam/dspam.conf ${include_conf[@]}|sed q)" ebegin "Stopping DSPAM" start-stop-daemon --stop --quiet --pidfile ${DSPAM_PID} eend ${?} }