#!@RCD_SCRIPTS_SHELL@ # # $NetBSD: courieresmtp.sh,v 1.5 2008/02/19 18:45:24 jlam Exp $ # # Courier ESMTP services daemon # # PROVIDE: courieresmtp # REQUIRE: authdaemond courierd # KEYWORD: shutdown . /etc/rc.subr name="courieresmtp" rcvar=${name} command="@PREFIX@/sbin/couriertcpd" ctl_command="@PREFIX@/sbin/esmtpd" pidfile="@COURIER_STATEDIR@/tmp/esmtp.pid" required_files="@PKG_SYSCONFDIR@/esmtpd @PKG_SYSCONFDIR@/esmtpd-ssl" start_precmd="${name}_prestart" start_cmd="${name}_doit start" stop_cmd="${name}_doit stop" mkdir_perms() { dir="$1"; user="$2"; group="$3"; mode="$4" @TEST@ -d $dir || @MKDIR@ $dir @CHOWN@ $user $dir @CHGRP@ $group $dir @CHMOD@ $mode $dir } courieresmtp_prestart() { mkdir_perms @COURIER_STATEDIR@/tmp \ @COURIER_USER@ @COURIER_GROUP@ 0770 } courieresmtp_doit() { action=$1 case $action in start) for f in $required_files; do if [ ! -r "$f" ]; then @ECHO@ 1>&2 "$0: WARNING: $f is not readable" return 1 fi done . @PKG_SYSCONFDIR@/esmtpd case x$ESMTPDSTART in x[yY]*) @ECHO@ "Starting ${name}." @TEST@ -f @PKG_SYSCONFDIR@/esmtpacceptmailfor.dat || @PREFIX@/sbin/makeacceptmailfor @TEST@ -f @PKG_SYSCONFDIR@/${ACCESSFILE}.dat || @PREFIX@/sbin/makesmtpaccess ${ctl_command} $action ;; esac ;; stop) @ECHO@ "Stopping ${name}." ${ctl_command} $action ;; esac } load_rc_config $name run_rc_command "$1"