forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3.4.1-spamd.init
55 lines (45 loc) · 1.2 KB
/
3.4.1-spamd.init
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
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PIDDIR=/run/spamd
PIDFILE=${PIDDIR}/spamd.pid
extra_started_commands="reload"
depend() {
before mta
use logger
@USEPOSTGRES@ use postgresql
@USEMYSQL@ use mysql
}
start() {
ebegin "Starting spamd"
# Ensure that the PID file's directory exists.
checkpath --directory "${PIDDIR}"
# Reloading spamd causes its PID to change, so we track it by
# name instead.
start-stop-daemon --start --quiet \
--name spamd \
--nicelevel ${SPAMD_NICELEVEL} \
--pidfile ${PIDFILE} \
--exec /usr/sbin/spamd -- \
--daemonize \
--pidfile=${PIDFILE} \
${SPAMD_OPTS}
retval=$?
eend ${retval} "Failed to start spamd"
}
stop() {
ebegin "Stopping spamd"
# Retry after SPAMD_TIMEOUT seconds because spamd can take a
# while to kill off all of its children. This was bug 322025.
start-stop-daemon --stop \
--quiet \
--retry ${SPAMD_TIMEOUT} \
--pidfile ${PIDFILE}
eend $? "Failed to stop spamd"
}
reload() {
ebegin "Reloading configuration"
# Warning: causes the PID of the spamd process to change.
start-stop-daemon --signal HUP --quiet --pidfile ${PIDFILE}
eend $?
}