Files
packages/admin/zabbix/files/zabbix_server.init
Daniel F. Dickinson ffdb7209a4 zabbix: add initscript for server
Adds an initscript for zabbix_server, and related helper files

+ uses a zabbix_server uci conf to enable/disable startup
+ updates the default zabbix_server.conf to work with initscript
+ add a sysctl.d conf to set max-files more appropriate for zabbix_server

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
2026-01-16 01:10:59 +02:00

43 lines
899 B
Bash
Executable File

#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2025 OpenWrt.org
# shellcheck disable=SC2034
START=59
# shellcheck disable=SC2034
USE_PROCD=1
NAME=zabbix_server
PROG=/usr/sbin/${NAME}
CONFIG=/etc/zabbix_server.conf
start_service() {
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
# shellcheck disable=SC2154
if [ "$enabled" -eq 0 ]; then
logger "service not enabled in /etc/config/$NAME"
return 1
fi
mkdir -p /var/run/zabbix
chown zabbix:zabbix /var/run/zabbix
procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param user zabbix
procd_set_param limits nofile="16384 100000"
procd_set_param file ${CONFIG}
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}