ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/mail/dovecot2/files/dovecot.in
Revision: 16349
Committed: Sun Apr 20 18:32:36 2014 UTC (10 years ago) by laffer1
File size: 1482 byte(s)
Log Message:
remove cvs2svn:cvs-rev prop

File Contents

# Content
1 #!/bin/sh
2 #
3 # $MidnightBSD$
4 #
5
6 # PROVIDE: dovecot
7 # REQUIRE: %%REQUIRE%%
8 # KEYWORD: shutdown
9
10 # Define dovecot_* variables in one of these files:
11 # /etc/rc.conf
12 # /etc/rc.conf.local
13 # /etc/rc.conf.d/dovecot
14
15 . /etc/rc.subr
16
17 name=dovecot
18 rcvar=dovecot_enable
19
20 # read configuration and set defaults
21 load_rc_config ${name}
22 : ${dovecot_enable:="NO"}
23 : ${dovecot_config:="%%ETCDIR%%/${name}.conf"}
24
25 command="%%PREFIX%%/sbin/${name}"
26 start_precmd="start_precmd"
27 stop_postcmd="stop_postcmd"
28 restart_cmd="restart_cmd"
29
30 start_precmd()
31 { # Ensure runtime directories exist with correct permissions
32 local login_user login_gid
33 login_user=$(${command} ${command_args} -a | /usr/bin/awk -F '= ' '/^default_login_user =/ { print $2 }')
34 login_gid=$(/usr/sbin/pw usershow -n "${login_user}" 2>/dev/null | /usr/bin/cut -d: -f4)
35 /usr/bin/install -o root -g wheel -m 0755 -d ${base_dir}
36 }
37
38 stop_postcmd()
39 { # Cleanup runtime directories
40 rm -rf ${base_dir} 2>/dev/null
41 }
42
43 restart_cmd()
44 { # Overriding makes rc.subr run this once for each instance
45 run_rc_command stop
46 run_rc_command start
47 }
48
49 # To start multiple instances of dovecot set dovecot_config to
50 # a space seperated list of configuration files.
51 if checkyesno ${name}_enable; then
52 for config in ${dovecot_config}; do
53 required_files="${config}"
54 command_args="-c ${config}"
55 base_dir=$(${command} ${command_args} -a | /usr/bin/awk -F '= ' '/^base_dir =/ { print $2 }')
56 pidfile="${base_dir}/master.pid"
57 run_rc_command "$1"
58 done
59 fi