Remove zabbix (moved to new feed)
[openwrt.org/packages.git] / admin / zabbix_agentd.init
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
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org

START=60

PROG=/usr/sbin/zabbix_agentd
CONFIG=/etc/zabbix_agentd.conf
SERVICE_PID_FILE=/var/run/zabbix_agentd.pid

start() {
	# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
	[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}

	[ -f ${CONFIG} ] || return 1

	grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
		logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
		return 1
	}

	grep -q "^AllowRoot=1" ${CONFIG} || {
		user_exists zabbix 53 || user_add zabbix 53
		group_exists zabbix 53 || group_add zabbix 53
		touch ${SERVICE_PID_FILE}
		chown zabbix:zabbix ${SERVICE_PID_FILE}
	}

	service_start ${PROG} -c ${CONFIG}
}

stop() {
	service_stop ${PROG}
}

comments