zabbix: switch zabbix_agentd to procd
run tested on ar71xx Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
This commit is contained in:
parent
e3576f3d0f
commit
f58e0a6407
2 changed files with 8 additions and 18 deletions
22
admin/zabbix/files/zabbix_agentd.init
Normal file → Executable file
22
admin/zabbix/files/zabbix_agentd.init
Normal file → Executable file
|
@ -3,29 +3,19 @@
|
||||||
|
|
||||||
START=60
|
START=60
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
PROG=/usr/sbin/zabbix_agentd
|
PROG=/usr/sbin/zabbix_agentd
|
||||||
CONFIG=/etc/zabbix_agentd.conf
|
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
|
# 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 /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
|
||||||
|
|
||||||
[ -f ${CONFIG} ] || return 1
|
[ -f ${CONFIG} ] || return 1
|
||||||
|
|
||||||
grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
|
procd_open_instance
|
||||||
logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
|
procd_set_param command ${PROG} -c ${CONFIG} -f
|
||||||
return 1
|
procd_set_param respawn
|
||||||
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
grep -q "^AllowRoot=1" ${CONFIG} || {
|
|
||||||
touch ${SERVICE_PID_FILE}
|
|
||||||
chown zabbix:zabbix ${SERVICE_PID_FILE}
|
|
||||||
}
|
|
||||||
|
|
||||||
service_start ${PROG} -c ${CONFIG}
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
service_stop ${PROG}
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
-# Mandatory: no
|
-# Mandatory: no
|
||||||
-# Default:
|
-# Default:
|
||||||
-# PidFile=/tmp/zabbix_agentd.pid
|
-# PidFile=/tmp/zabbix_agentd.pid
|
||||||
+# Only /var/run/zabbix_agentd.pid supported
|
+# We do not need PidFile with procd
|
||||||
+PidFile=/var/run/zabbix_agentd.pid
|
+# PidFile=/var/run/zabbix_agentd.pid
|
||||||
|
|
||||||
### Option: LogFile
|
### Option: LogFile
|
||||||
# Name of log file.
|
# Name of log file.
|
||||||
|
|
Loading…
Reference in a new issue