You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
825 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2008-2011 OpenWrt.org
  3. START=60
  4. PROG=/usr/sbin/zabbix_agentd
  5. CONFIG=/etc/zabbix_agentd.conf
  6. SERVICE_PID_FILE=/var/run/zabbix_agentd.pid
  7. start() {
  8. # Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
  9. [ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
  10. [ -f ${CONFIG} ] || return 1
  11. grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
  12. logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
  13. return 1
  14. }
  15. grep -q "^AllowRoot=1" ${CONFIG} || {
  16. user_exists zabbix 53 || user_add zabbix 53
  17. group_exists zabbix 53 || group_add zabbix 53
  18. touch ${SERVICE_PID_FILE}
  19. chown zabbix:zabbix ${SERVICE_PID_FILE}
  20. }
  21. service_start ${PROG} -c ${CONFIG}
  22. }
  23. stop() {
  24. service_stop ${PROG}
  25. }