summaryrefslogtreecommitdiff
blob: fca5f12acf2c823cb2788bfab52a76725d6ba43b (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
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

name="amavisd-snmp"
pidfile="/run/amavis/${name}.pid"
command="/usr/sbin/${name}-subagent"
command_args="${amavis_snmp_args} -P ${pidfile}"
start_stop_daemon_args="--interpreted"

update_command() {
	if [[ -x ${command}-zmq && ! $amavisd_snmp_command ]]; then
		command="${command}-zmq"
	elif [[ $amavisd_snmp_command ]]; then
		command="$amavisd_snmp_command"
	fi
}

depend() {
	use logger
	before amavisd-new snmpd
	update_command
	if [[ ${command##*-} == "zmq" ]]; then
		need amavis-mc
	fi
}

start_pre() {
	update_command
	checkpath -d -o amavis /run/amavis
}