#! @SHELL@
#
# Copyright 2004-2005 Double Precision, Inc.
# See COPYING for distribution information.

prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
sysconfdir="@sysconfdir@"
sbindir="@sbindir@"
bindir="@bindir@"
libexecdir="@libexecdir@"
datadir="@datadir@"

. ${sysconfdir}/sqwebmaild

case $1 in
start)
	case "`cat ${sysconfdir}/calendarmode 2>/dev/null`" in
	net)
	@SETENV@ -i @SHELL@ -c " set -a ;
		prefix=${prefix} ;
		exec_prefix=${exec_prefix} ;
		sbindir=${sbindir} ;
		libexecdir=${libexecdir} ;
		. ${sysconfdir}/sqwebmaild ; \
		@courierlogger@ -pid=${PIDFILE}.pcp $LOGGEROPTS -start \
			${libexecdir}/courier/pcpd server"
		;;
	*)
		;;
	esac

	@SETENV@ -i @SHELL@ -c " set -a ;
		prefix=${prefix} ;
		exec_prefix=${exec_prefix} ;
		sbindir=${sbindir} ;
		libexecdir=${libexecdir} ;
		. ${sysconfdir}/sqwebmaild ; \
		@courierlogger@ -pid="'${PIDFILE}'" $LOGGEROPTS -start \
			${libexecdir}/courier/sqwebmaild"
	;;
stop)
	@courierlogger@ -pid=${PIDFILE} -stop
	@courierlogger@ -pid=${PIDFILE}.pcp -stop
	;;
reload)
	@courierlogger@ -pid=${PIDFILE} -restart
	@courierlogger@ -pid=${PIDFILE}.pcp -restart
	;;
esac
