aboutsummaryrefslogtreecommitdiffstats
path: root/community/rspamd/rspamd.initd
blob: 79e9d0d910faca793b0f7b8cefd2e1ed2a744435 (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
38
39
40
41
42
43
44
45
46
#!/sbin/openrc-run

description="Rapid spam filtering system"

: ${user:=${RSPAMD_USER:-rspamd}}
: ${group:=${RSPAMD_GROUP:-rspamd}}
: ${cfgdir:=${RSPAMD_CONFDIR:-/etc/rspamd}}
: ${cfgfile:=${RSPAMD_CONFIG:-$cfgdir/rspamd.conf}}
: ${pidfile:=${RSPAMD_PIDFILE:-/run/$RC_SVCNAME/rspamd.pid}}

command=/usr/sbin/rspamd
command_args="-u $user -g $group -c $cfgfile -p $pidfile"
required_files="$cfgfile"
extra_commands="checkconfig"
extra_started_commands="reload reopen"
description_checkconfig="Verify configuration"
description_reload="Reload configuration"
description_reopen="Reopen log files"

depend() {
	need localmount net
	before mta
}

checkconfig() {
	ebegin "Checking $RC_SVCNAME config"
	$command $command_args -t
	eend $?
}

start_pre() {
	checkpath -d -m 750 -o $user:$group ${pidfile%/*}
	checkconfig >/dev/null 2>>${startuplog:=${RSPAMD_STARTUPLOG:-/dev/null}}
}

reload() {
	ebegin "Reloading $RC_SVCNAME config"
	checkconfig >/dev/null 2>&1 && start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}

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