summaryrefslogtreecommitdiff
path: root/mail/mailman/files/mailman.in
blob: fc0c7c095a385d9af934c2e51f3628ab68151635 (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
55
56
57
58
59
60
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mailman
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable or configure mailman:
#
# mailman_enable (bool):        Set it to "YES" to enable mailman.
#                               Default is "NO".
#
# mailman_fix_perms (bool):     Set it to "NO" to disable running
#                               check_perms on start or post-install.
#                               Default is "YES", but this is unsuitable
#                               for slow machines with many lists.

. /etc/rc.subr

name="mailman"
rcvar=mailman_enable

pidfile="%%MAILMANDIR%%/data/master-qrunner.pid"

load_rc_config $name

: ${mailman_enable="NO"}
: ${mailman_fix_perms="YES"}

start_cmd=${name}_start
stop_cmd=${name}_stop
status_cmd=${name}_status
extra_commands="reload status"

mailman_start() {
	if checkyesno mailman_fix_perms ; then 
	    env LC_ALL=C %%MAILMANDIR%%/bin/check_perms -f
	fi
	%%MAILMANDIR%%/bin/mailmanctl -s -q start
}

mailman_stop() {
	[ -f $pidfile ] \
	  && %%MAILMANDIR%%/bin/mailmanctl -q stop \
	  || echo ${name} not running? \(check ${pidfile}\)
}

mailman_status() {
	local retcode=0
	if [ -f $pidfile ] && ps -p $(cat $pidfile) > /dev/null; then
		echo $name is running as pid $(cat $pidfile).
	else
		echo $name is not running.
		retcode=1
	fi
	return $retcode
}

run_rc_command "$1"