#!/bin/sh
#
# chkconfig: 2345 64 32
# description: exim SMTP daemon

PIDFILE="/var/run/exim.pid"

# See how we were called.
case "$1" in
	start)
# permissions should be same as in logrotate config
		mkdir -p /var/log/exim
		touch /var/log/exim/main.log /var/log/exim/reject.log
		chmod 750 /var/log/exim
		chmod 640 /var/log/exim/*.log
		chown -R mail:wheel /var/log/exim
		/usr/sbin/exim -bd -q30m
		;;
	stop)
		kill -15 `cat $PIDFILE` && sleep 1
		;;
	restart)
		$0 stop
		$0 start
		;;
	*)
		echo "Usage: ${0##*/} {start|stop|restart}"
		exit 1
esac

exit $?
