summaryrefslogtreecommitdiff
path: root/user/rspamd/rspamd.initd
diff options
context:
space:
mode:
authorLee Starnes <lee@canned-death.us>2020-09-19 00:12:15 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2020-09-19 00:12:15 +0000
commitcdd03f807a0d8346bc0fe7d1187ee0befe356624 (patch)
treec93df99f16f224157b252f5337e7e421d07888f4 /user/rspamd/rspamd.initd
parentdb49432374e0e3ed11d99c831d1349f3ddc74a33 (diff)
downloadpackages-cdd03f807a0d8346bc0fe7d1187ee0befe356624.tar.gz
packages-cdd03f807a0d8346bc0fe7d1187ee0befe356624.tar.bz2
packages-cdd03f807a0d8346bc0fe7d1187ee0befe356624.tar.xz
packages-cdd03f807a0d8346bc0fe7d1187ee0befe356624.zip
user/rspamd: import from Alpine, disable JIT, and use lua5.3
Diffstat (limited to 'user/rspamd/rspamd.initd')
-rw-r--r--user/rspamd/rspamd.initd51
1 files changed, 51 insertions, 0 deletions
diff --git a/user/rspamd/rspamd.initd b/user/rspamd/rspamd.initd
new file mode 100644
index 000000000..aaa40428b
--- /dev/null
+++ b/user/rspamd/rspamd.initd
@@ -0,0 +1,51 @@
+#!/sbin/openrc-run
+
+extra_commands="checkconfig"
+extra_started_commands="reload reopen"
+
+description="Rapid spam filtering system"
+description_checkconfig="Check configuration"
+description_reload="Reload configuration"
+description_reopen="Reopen log files"
+
+# Uppercase variables are here for backward compatibility only.
+: ${command_user:="${RSPAMD_USER:-rspamd}:${RSPAMD_GROUP:-rspamd}"}
+: ${cfgfile:=${RSPAMD_CONFIG:-/etc/rspamd/rspamd.conf}}
+: ${startuplog:=${RSPAMD_STARTUPLOG:-/dev/null}}
+
+command="/usr/sbin/rspamd"
+command_args="--config $cfgfile --no-fork ${command_args:-}"
+command_background="yes"
+pidfile="/run/rspamd/$RC_SVCNAME.pid"
+
+required_files="$cfgfile"
+
+depend() {
+ need localmount net
+ before mta
+ after redis
+}
+
+start_pre() {
+ checkpath -d -m 755 -o "$command_user" ${pidfile%/*}
+ checkconfig >/dev/null 2>>"$startuplog" || checkconfig
+}
+
+checkconfig() {
+ ebegin "Checking $name configuration"
+
+ rspamadm configtest
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading $name configuration"
+ start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
+ eend $?
+}
+
+reopen() {
+ ebegin "Reopening $name log files"
+ start-stop-daemon --signal USR1 --pidfile $pidfile
+ eend $?
+}