aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rspamd/rspamd.initd
blob: 93148ccb4b2604e0f988891e1062fa2e5fbb7ceb (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
#!/sbin/openrc-run

description="Rapid spam filtering system"
user=${user:-rspamd}
group=${group:-rspamd}
cfgfile=${cfgfile:-/etc/rspamd/rspamd.conf}
pidfile=${pidfile:-/run/rspamd/rspamd.pid}
command=/usr/sbin/rspamd
command_args="-u $user -g $group -c $cfgfile -p $pidfile"
required_files="$cfgfile"
extra_started_commands="reload reopen"
description_reload="Reload configuration"
description_reopen="Reopen log files"

depend() {
	need localmount net
	before mta
}

start_pre() {
	ebegin
	checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*}
	$command $command_args -t >/dev/null 2>>${startuplog:-/dev/null}
	eend $?
}

reload() {
	ebegin "Reloading ${SVCNAME}"
	start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}

reopen() {
	ebegin "Reopening ${SVCNAME} log files"
	start-stop-daemon --signal USR1 --pidfile $pidfile
	eend $?
}