summaryrefslogtreecommitdiff
blob: f4b2bbf923db94e01b52e2531411283ff5684f91 (plain)
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
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/cyrus-imspd/files/imspd.rc6,v 1.2 2004/03/06 03:19:43 vapier Exp $

depend() {
	need net
	use dns logger
	after saslauthd
}

use_ssl() {
	if [ "${IMSPD_USE_SSL}" = "yes" -a -x /usr/sbin/stunnel -a -f /etc/stunnel/imspd.conf ] ; then
		echo "yes"
		return 0
	fi

	return 1
}

start() {
	ebegin "Starting cyrus imspd"
	start-stop-daemon --start --quiet --background --make-pidfile \
		--pidfile /var/run/imspd.pid --exec /usr/sbin/imspd
	eend $?
	
	if [ -n "`use_ssl`" ] ; then
		ebegin "Starting cyrus imspd ssl tunnel"
		start-stop-daemon --start --quiet --exec /usr/sbin/stunnel \
			-- /etc/stunnel/imspd.conf
		eend $?
	fi
}

stop() {
	if [ -n "`use_ssl`" ] ; then
		ebegin "Stopping cyrus imspd ssl tunnel"
		start-stop-daemon --stop --quiet \
			--pidfile /var/run/stunnel.imspd.pid
		eend $?
	fi

	ebegin "Stopping cyrus imspd"
	start-stop-daemon --stop --quiet --pidfile /var/run/imspd.pid
	eend $?
}