blob: 9939f8056920329ec37388e8b071d478964bd026 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/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
}
|