aboutsummaryrefslogtreecommitdiff
path: root/mail/sqwebmail/files/sqwebmail-sqwebmaild.in
blob: f1490954b700e29c68e530a0e46515f5ba512d33 (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
#!/bin/sh
#
# An rc.subr-style startup script for the sqwebmaild service.

# PROVIDE: sqwebmaild
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Define these sqwebmaild_* variables in one of these files:
# 	/etc/rc.conf
# 	/etc/rc.conf.local
# 	/etc/rc.conf.d/sqwebmaild
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE

sqwebmaild_enable=${sqwebmaild_enable-"NO"}

. /etc/rc.subr

name="sqwebmaild"
rcvar=`set_rcvar`
command="%%PREFIX%%/libexec/sqwebmaild.rc"

start_cmd="sqwebmaild_cmd start"
stop_cmd="sqwebmaild_cmd stop"
restart_cmd="sqwebmaild_cmd stop && sqwebmaild_cmd start"
pidfile="%%PREFIX%%/var/sqwebmail/run/sqwebmaild.pid"
procname="%%PREFIX%%/sbin/courierlogger"

load_rc_config $name

sqwebmaild_cmd () {
	case $1 in
	start)
		echo "Starting ${name}."
		${command} start
		;;
	stop)
		echo "Stopping ${name}."
		${command} stop
		if [ $? -eq 0 ] ; then
			for file in "$pidfile" "$pidfile".lock "$pidfile".pcp.lock %%PREFIX%%/var/sqwebmail/sqwebmail.sock ; do
				[ -f "$file" -o -S "$file" ] && rm -f "$file"
			done
			return 0
		fi
		;;
	esac
}

run_rc_command "$1"