summaryrefslogtreecommitdiff
path: root/nonsystemd/spamassassin-openrc/spamassassin.initd
diff options
context:
space:
mode:
Diffstat (limited to 'nonsystemd/spamassassin-openrc/spamassassin.initd')
-rw-r--r--nonsystemd/spamassassin-openrc/spamassassin.initd38
1 files changed, 38 insertions, 0 deletions
diff --git a/nonsystemd/spamassassin-openrc/spamassassin.initd b/nonsystemd/spamassassin-openrc/spamassassin.initd
new file mode 100644
index 000000000..31eeacbf6
--- /dev/null
+++ b/nonsystemd/spamassassin-openrc/spamassassin.initd
@@ -0,0 +1,38 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+: ${SPAMD_TIMEOUT:=15}
+: ${SPAMD_NICELEVEL:=0}
+
+supervisor=supervise-daemon
+command="/usr/bin/vendor_perl/spamd"
+pidfile="/run/spamd.pid"
+command_args="${SPAMD_OPTS}"
+supervise_daemon_args="--nicelevel ${SPAMD_NICELEVEL}"
+
+# Retry after SPAMD_TIMEOUT seconds because spamd can take a
+# while to kill off all of its children. This was bug 322025.
+retry="${SPAMD_TIMEOUT}"
+
+if ! [ "${SPAMD_RUN_AS_ROOT}" = "true" ]; then
+ # Passing --username=root to spamd kills it, so if SPAMD_RUN_AS_ROOT
+ # is true, then we want to pass no user/group command args at all.
+ # Any value other than "true" gets the default user/group of "spamd".
+ command_args="${command_args} --username=spamd --groupname=spamd"
+fi
+
+extra_started_commands="reload"
+
+depend() {
+ before mta
+ use logger mysql postgresql
+}
+
+reload() {
+ ebegin "Reloading configuration"
+ # Warning: reload causes the PID of the spamd process to
+ # change, but spamd does update its PID file afterwards.
+ supervise-daemon spamassassin --signal HUP
+ eend $?
+}