summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mail-filter/spamassassin/files/3.4.1-spamd.init')
-rw-r--r--mail-filter/spamassassin/files/3.4.1-spamd.init56
1 files changed, 56 insertions, 0 deletions
diff --git a/mail-filter/spamassassin/files/3.4.1-spamd.init b/mail-filter/spamassassin/files/3.4.1-spamd.init
new file mode 100644
index 00000000000..7d2af814a03
--- /dev/null
+++ b/mail-filter/spamassassin/files/3.4.1-spamd.init
@@ -0,0 +1,56 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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 $?
+}