summaryrefslogtreecommitdiff
path: root/mail/rspamd/files/rspamd.sh
blob: 2444f6008e1822e9d7011137c3ee9f1c5fed0261 (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: rspamd.sh,v 1.2 2018/02/01 09:07:23 fhajny Exp $
#
# PROVIDE: rspamd
# REQUIRE: DAEMON
# BEFORE: mail

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

name="rspamd"
rcvar=$name
command="@PREFIX@/bin/rspamd"
pidfile="@VARBASE@/run/rspamd/${name}.pid"
command_args="-u @RSPAMD_USER@ -g @RSPAMD_GROUP@ -c @PKG_SYSCONFDIR@/rspamd.conf"
required_files="@PKG_SYSCONFDIR@/rspamd.conf"
start_precmd="rspamd_precmd"

rspamd_precmd()
{
	if [ ! -d @VARBASE@/run/rspamd ]; then
		@MKDIR@ @VARBASE@/run/rspamd
		@CHMOD@ 0755 @VARBASE@/run/rspamd
		@CHOWN@ @RSPAMD_USER@:@RSPAMD_GROUP@ @VARBASE@/run/rspamd
	fi
}

if [ -f /etc/rc.subr ]; then
        load_rc_config $name
	run_rc_command "$1"
else
	echo -n " ${name}"
	${command} ${rspamd_flags} ${command_args}
fi