ports/mail/p5-qpsmtpd/files/qpsmtpd.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

56 lines
1.4 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: qpsmtpd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# qpsmtpd_enable (bool): Set to NO by default
# Set it to YES to enable qpsmtpd
# qpsmtpd_user (string): Set to "nobody" by default
# The user to run qpsmtpd-forkserver as
# qpsmtpd_group (string): Set to "nogroup" by default
# The group the pid dir will be chowned to
# qpsmtpd_port (int): Set to 2525 by default
# The port it should listen on
# qpsmtpd_max_per_ip (int): Set to 3 by default
# Max connections per IP
# qpsmtpd_max_connections (int): Set to 15 by default
# Maximum total connections
# qpsmtpd_listen_on (address): Set to 0.0.0.0 by default
# IP address to listen on
. /etc/rc.subr
name="qpsmtpd"
rcvar=qpsmtpd_enable
command="%%PREFIX%%/bin/qpsmtpd-forkserver"
command_interpreter=%%PERL%%
pidfile="/var/run/qpsmtpd/qpsmtpd.pid"
start_precmd=${name}_prestart
qpsmtpd_prestart()
{
[ -d /var/run/qpsmtpd ] || mkdir /var/run/qpsmtpd
chown $qpsmtpd_user:$qpsmtpd_group /var/run/qpsmtpd
}
load_rc_config $name
: ${qpsmtpd_enable="NO"}
: ${qpsmtpd_user="nobody"}
: ${qpsmtpd_group="nogroup"}
: ${qpsmtpd_port="2525"}
: ${qpsmtpd_max_per_ip="3"}
: ${qpsmtpd_max_connections="15"}
: ${qpsmtpd_listen_on="0.0.0.0"}
command_args="-d -p $qpsmtpd_port -c $qpsmtpd_max_connections -u $qpsmtpd_user -m $qpsmtpd_max_per_ip -l $qpsmtpd_listen_on --pid-file $pidfile"
run_rc_command "$1"