zabbix: switch zabbix_agentd to procd
authorEtienne CHAMPETIER <champetier.etienne@gmail.com>
Sun, 21 Jun 2015 14:10:34 +0000 (16:10 +0200)
committerEtienne CHAMPETIER <champetier.etienne@gmail.com>
Fri, 10 Jul 2015 22:34:31 +0000 (00:34 +0200)
run tested on ar71xx

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
admin/zabbix/files/zabbix_agentd.init [changed mode: 0644->0755]
admin/zabbix/patches/010-change-agentd-config.patch

old mode 100644 (file)
new mode 100755 (executable)
index c806a9f..86f1ced
@@ -3,29 +3,19 @@
 
 START=60
 
+USE_PROCD=1
 PROG=/usr/sbin/zabbix_agentd
 CONFIG=/etc/zabbix_agentd.conf
-SERVICE_PID_FILE=/var/run/zabbix_agentd.pid
 
-start() {
+start_service() {
        # 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} || {
-               touch ${SERVICE_PID_FILE}
-               chown zabbix:zabbix ${SERVICE_PID_FILE}
-       }
-
-       service_start ${PROG} -c ${CONFIG}
+       procd_open_instance
+       procd_set_param command ${PROG} -c ${CONFIG} -f
+       procd_set_param respawn
+       procd_close_instance
 }
 
-stop() {
-       service_stop ${PROG}
-}
index ccc36d1b40cc5ba8583f796e811d7dd575e02919..e4812f6ef97de80bdc6292509f44e5ca3fa28c84 100644 (file)
@@ -10,8 +10,8 @@
 -# Mandatory: no
 -# Default:
 -# PidFile=/tmp/zabbix_agentd.pid
-+# Only /var/run/zabbix_agentd.pid supported
-+PidFile=/var/run/zabbix_agentd.pid
++# We do not need PidFile with procd
++PidFile=/var/run/zabbix_agentd.pid
  
  ### Option: LogFile
  #     Name of log file.