#!/bin/sh
#
# Exim startup script.
#
# This could perhaps integrate with Red Hat's init scripts better...
#
# $Cambridge: hermes/conf/exim/etc/rc.functions,v 1.9 2004/11/11 15:25:17 fanf2 Exp $

killpid () {
	[ -f $PIDFILE ] && kill "$@" `cat $PIDFILE`
}

stop () {
	killpid || true
	rm -f $PIDFILE
}

start () {
	eval $PROG
}

case "$1" in
stop)
	killpid -0 2>/dev/null && killall exim
	rm -f $PIDFILE
	;;
graceful-stop)
	stop
	;;
start)
	killpid -0 || start
	;;
reload)
	killpid -HUP
	;;
restart)
	stop
	start
	;;
status)
	if killpid -0
	then
		echo $PROG running as process `cat $PIDFILE`
	else
		echo $PROG not running
	fi
	;;
*)
	echo "Usage: $0 {start|stop|reload|restart|status}"
	exit 1
esac
