#!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # $Header: /var/cvsroot/gentoo-x86/mail-mta/nullmailer/files/init.d-nullmailer,v 1.1 2006/01/30 03:50:34 robbat2 Exp $ DAEMON="/usr/sbin/nullmailer-send" ARGS="--daemon" USER=nullmail GROUP=nullmail depend() { need net logger } checkconfig() { local error=0 local f=/etc/nullmailer/me if [ ! -s ${f} ]; then eerror "${f} does not exist" error=1 fi f=/etc/nullmailer/defaultdomain if [ ! -s ${f} ]; then eerror "${f} does not exist" error=1 fi if [ ${error} -eq 1 ]; then einfo "You need to run 'emerge --config nullmailer'!" fi if [ -e /service/nullmailer ]; then eerror "Nullmailer is already running under svscan!" error=2 fi if [ ${error} -ne 0 ]; then return 1 else return 0 fi } start() { checkconfig ebegin "Starting nullmailer" cd /var/nullmailer start-stop-daemon --start --quiet --chuid ${USER}:${GROUP} \ --exec ${DAEMON} -- ${ARGS} eend $? } stop() { checkconfig # to avoid init.d stopping svscan instance ebegin "Stopping nullmailer" cd /var/nullmailer start-stop-daemon --stop --user ${USER} --exec ${DAEMON} eend $? }