summaryrefslogtreecommitdiff
blob: 07e8a4a98b08486ec15c732033eacb7fc9ce3267 (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
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/zabbix/files/2.0/init.d/zabbix-agentd,v 1.3 2012/08/01 22:27:49 mattm Exp $

pid_file="/var/run/zabbix/zabbix_agentd.pid"
dir="/var/run/zabbix"

depend() {
	need net
	provide zabbix-agent
	use zabbix-server
}

start() {
        if [ ! -d "${dir}" ]; then
          einfo " Creating ${dir}"
	  /bin/mkdir -p "${dir}"
	  /bin/chown zabbix:zabbix "${dir}"
	fi
	ebegin "Starting Zabbix agent"
	start-stop-daemon --start --pidfile ${pid_file} \
		--user zabbix --group zabbix --exec /usr/sbin/zabbix_agentd -- -c /etc/zabbix/zabbix_agentd.conf
	eend $?
}

stop() {
	ebegin "Stopping Zabbix agent"
	start-stop-daemon  --stop --pidfile ${pid_file}
	eend $?
}