blob: 397ed477515657a1ea251300ef91e41b71aba305 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/perdition/files/perdition.initd,v 1.3 2011/06/15 15:24:06 eras Exp $
depend() {
need net
}
check_key() {
if [ ! -e /etc/perdition/perdition.crt.pem ] ; then
einfo "No SSL keys; see man perdition to create them. Or run: "
einfo "$ openssl req -new -x509 -nodes -out /etc/perdition/perdition.crt.pem -keyout /etc/perdition/perdition.key.pem -days 365"
return 1
fi
}
checkconfig() {
# create PIDDIR (usually /var/run/perdition) if necessary
if [ ! -d "${PIDDIR:-/var/run/perdition}" ] ; then
checkpath -q -d -o ${PERDITION_USER:-perdition}:${PERDITION_USER:-perdition} \
-m 0775 "${PIDDIR:-/var/run/perdition}" || return 1
fi
}
start() {
checkconfig || return 1
if [ "${POP3}" = "yes" ]; then
ebegin "Starting perdition services (POP3)"
start-stop-daemon --quiet --start --startas /usr/sbin/perdition.pop3 -p ${PIDDIR}/pop3.pid \
-- ${FLAGS} ${POP3_FLAGS} -u ${PERDITION_USER} --pid_file ${PIDDIR}/pop3.pid
eend $?
fi
if [ "${POP3S}" = "yes" ]; then
check_key || return 1
ebegin "Starting perdition services (POP3S)"
start-stop-daemon --quiet --start --startas /usr/sbin/perdition.pop3s -p ${PIDDIR}/pop3s.pid \
-- ${FLAGS} ${POP3S_FLAGS} -u ${PERDITION_USER} --pid_file ${PIDDIR}/pop3s.pid
eend $?
fi
if [ "${IMAP4}" = "yes" ]; then
ebegin "Starting perdition services (IMAP4)"
start-stop-daemon --quiet --start --startas /usr/sbin/perdition.imap4 -p ${PIDDIR}/imap4.pid \
-- ${FLAGS} ${IMAP4_FLAGS} -u ${PERDITION_USER} --pid_file ${PIDDIR}/imap4.pid
eend $?
fi
if [ "${IMAP4S}" = "yes" ]; then
check_key || return 1
ebegin "Starting perdition services (IMAP4S)"
start-stop-daemon --quiet --start --startas /usr/sbin/perdition.imap4s -p ${PIDDIR}/imap4s.pid \
-- ${FLAGS} ${IMAP4S_FLAGS} -u ${PERDITION_USER} --pid_file ${PIDDIR}/imap4s.pid
eend $?
fi
}
stop() {
if [ "${POP3}" = "yes" ]; then
ebegin "Shutting down perdition services (POP3)"
start-stop-daemon -o --quiet --stop --pidfile ${PIDDIR}/pop3.pid
eend $?
fi
if [ "${POP3S}" = "yes" ]; then
ebegin "Shutting down perdition services (POP3S)"
start-stop-daemon -o --quiet --stop --pidfile ${PIDDIR}/pop3s.pid
eend $?
fi
if [ "${IMAP4}" = "yes" ]; then
ebegin "Shutting down perdition services (IMAP4)"
start-stop-daemon -o --quiet --stop --pidfile ${PIDDIR}/imap4.pid
eend $?
fi
if [ "${IMAP4S}" = "yes" ]; then
ebegin "Shutting down perdition services (IMAP4S)"
start-stop-daemon -o --quiet --stop --pidfile ${PIDDIR}/imaps.pid
eend $?
fi
}
|