#!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/mail-filter/dkim-milter/files/dkim-filter.init,v 1.4 2008/01/24 11:39:15 mrness Exp $ CONFFILE=/etc/mail/dkim-filter/${SVCNAME}.conf PIDFILE=/var/run/dkim-filter/${SVCNAME}.pid depend() { use dns logger net } check_cfg() { if [ ! -f "${CONFFILE}" ] ; then eerror "Configuration file ${CONFFILE} is missing" return 1 fi if egrep -q '^[[:space:]]*Background[[:space:]]+no' "${CONFFILE}" ; then eerror "${SVCNAME} service cannot run with Background key set to yes!" return 1 fi if egrep -q '^[[:space:]]*PidFile[[:space:]]' "${CONFFILE}"; then eerror "Please remove PidFile key from your configuration file!" eerror "${SVCNAME} is automatically configured to use ${PIDFILE} as pid file." return 1 fi } start() { check_cfg || return 1 # Remove stalled Unix socket if no other process is using it local UNIX_SOCKET=$(sed -ne 's/^[[:space:]]*Socket[[:space:]]\+\(unix\|local\)://p' "${CONFFILE}") if [ -S "${UNIX_SOCKET}" ] && ! fuser -s "${UNIX_SOCKET}"; then rm "${UNIX_SOCKET}" fi ebegin "Starting DKIM filter" start-stop-daemon --start --pidfile "${PIDFILE}" \ --exec /usr/bin/dkim-filter -- -x "${CONFFILE}" -P "${PIDFILE}" eend $? } stop() { ebegin "Stopping DKIM filter" start-stop-daemon --stop --pidfile "${PIDFILE}" eend $? }