#
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=zabbix
PKG_VERSION:=1.6
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/zabbix
$(INSTALL_BIN) ./files/zabbix_agentd.init $(1)/etc/init.d/zabbix_agentd
endef
-define Package/zabbix-agent/postinst
-#!/bin/sh
-
-name=zabbix
-id=53
-
-# do not change below
-# check if we are on real system
-if [ -z "$${IPKG_INSTROOT}" ]; then
- # create copies of passwd and group, if we use squashfs
- rootfs=`mount |awk '/root/ { print $$5 }'`
- if [ "$$rootfs" = "squashfs" ]; then
- if [ -h /etc/group ]; then
- rm /etc/group
- cp /rom/etc/group /etc/group
- fi
- if [ -h /etc/passwd ]; then
- rm /etc/passwd
- cp /rom/etc/passwd /etc/passwd
- fi
- fi
-
- echo ""
- if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
- echo "adding group $$name to /etc/group"
- echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
- fi
-
- if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
- echo "adding user $$name to /etc/passwd"
- echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
- fi
-
- chown $${name} $${IPKG_INSTROOT}/etc/zabbix/zabbix_agentd.conf
-fi
-
-endef
-
define Package/zabbix-sender/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zabbix_sender $(1)/usr/sbin/
# Name of PID file
-PidFile=/tmp/zabbix_agentd.pid
+PidFile=/var/run/zabbix/zabbix_agentd.pid
# Name of log file.
# If not set, syslog will be used
-LogFile=/tmp/zabbix_agentd.log
+LogFile=/var/log/zabbix/zabbix_agentd.log
# Spend no more than Timeout seconds on processing
# Must be between 1 and 30
#!/bin/sh /etc/rc.common
-# Copyright (C) 2008 OpenWrt.org
+# Copyright (C) 2008-2011 OpenWrt.org
+
START=60
+SERVICE_PID_FILE=/var/run/zabbix/zabbix_agentd.pid
+
start() {
- [ -f /etc/zabbix/zabbix_agentd.conf ] || {
- echo "/etc/zabbix/zabbix_agentd.conf does not exist !";
- exit 0;
- };
- [ -x /usr/sbin/zabbix_agentd ] && /usr/sbin/zabbix_agentd
+ [ -f /etc/zabbix/zabbix_agentd.conf ] || return 1
+ user_exists zabbix 53 || user_add zabbix 53
+ group_exists zabbix 53 || group_add zabbix 53
+ [ -d /var/log/zabbix ] || {
+ mkdir -m0755 -p /var/log/zabbix
+ chown zabbix:zabbix /var/log/zabbix
+ }
+ [ -d /var/run/zabbix ] || {
+ mkdir -m0755 -p /var/run/zabbix
+ chown zabbix:zabbix /var/run/zabbix
+ }
+ service_start /usr/sbin/zabbix_agentd
}
stop() {
- killall zabbix_agentd
-}
-
-restart() {
- stop
- sleep 1
- start
+ service_stop /usr/sbin/zabbix_agentd
}