Files
Daniel F. Dickinson 355665cfb5 zabbix: bring proxy to parity with server and agentd
* Add config file patch for proxy
* Add initscript for proxy
* Update Makefile and support files to bring proxy to parity with
  agentd and server.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
2026-07-31 12:50:45 +03:00

51 lines
1.0 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2025 OpenWrt.org
# shellcheck shell=busybox
# shellcheck disable=SC2034
START=59
# shellcheck disable=SC2034
USE_PROCD=1
NAME=zabbix_proxy
PROG=/usr/sbin/${NAME}
CONFIG=/etc/${NAME}.conf
UCI_CONFIG=/etc/config/${NAME}
USER=zabbix-proxy
start_service() {
local enabled never_root
if [ ! -f "${CONFIG}" ]; then
logger "Configuration file not found: '${CONFIG}'"
return 1
fi
# Get enabled config option
config_load "$NAME"
config_get_bool enabled general enabled 0
config_get_bool never_root general never_root 1
# shellcheck disable=SC2154
if [ "$enabled" -eq 0 ]; then
logger "service not enabled in $UCI_CONFIG"
return 1
fi
mkdir -p "/var/run/$USER"
chown $USER:$USER "/var/run/$USER"
procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
if [ "$never_root" -eq 1 ]; then
procd_set_param user ${USER}
fi
procd_set_param file ${CONFIG}
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}