aboutsummaryrefslogtreecommitdiff
path: root/mail/p5-qpsmtpd/files/qpsmtpd.in
blob: 26bb32c63beab64d9805f6f51bf3b35cdac7511a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

# 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"