summaryrefslogtreecommitdiff
path: root/net-nds/389-ds-base/files/389-ds-snmp.initd
blob: ffc4e172ac1e64d29e4d37a5de508d6270906452 (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
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

PIDFILE="/run/ldap-agent.pid"
CONFIGFILE="/etc/dirsrv/config/ldap-agent.conf"

# instance support in progress

depend() {
	need net
	use logger snmpd
}

start() {
	ebegin "Starting 389 Directory Server ldap-snmp agent"
	start-stop-daemon --start --quiet -b \
		--pidfile ${PIDFILE} --exec /usr/sbin/ldap-agent -- ${CONFIGFILE}
	eend ${?}
	if [ "${?}" != "0" ]; then
		local entries=/etc/dirsrv/slapd-*
		if [ -n "${entries}" ]; then
			ewarn "Please make sure that ${CONFIGFILE} contains at least"
			ewarn "one of the following entries:"
			for entry in ${entries}; do
				entry=$(basename ${entry})
				ewarn "server ${entry}"
			done
		fi
	fi
}

stop() {
	ebegin "Stopping 389 Directory Server ldap-snmp agent"
	start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
	eend ${?}
}

restart() {
	svc_stop
	sleep 2
	svc_start
}