ports/net-mgmt/zabbix74-server/files/zabbix_agentd.in
Juraj Lutter a669ab74cd net-mgmt/zabbix74: Add new ports
Add zabbix74 ports, a Standard release. Its support will last
until there will be 8.0 LTS release (at the latest in Q3/2026).

The upgrade notes can be found at:
https://www.zabbix.com/documentation/7.4/en/manual/installation/upgrade_notes_740

Release notes:	https://www.zabbix.com/rn/rn7.4.0
2025-07-01 10:29:14 +02:00

68 lines
2.0 KiB
Bash

#!/bin/sh
# PROVIDE: zabbix_agentd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf to
# enable zabbix_agentd:
#
# zabbix_agentd_enable (bool): Set to NO by default. Set it to YES to
# enable zabbix_agentd.
# zabbix_agentd_config (string): Set to the standard config file path by
# default.
# zabbix_agentd_pidfile (string): Location of the zabbix_agent pid file
# Default is /var/run/zabbix/zabbix_agentd.pid
# zabbix_agentd_paths (string): Set to standard path by default. Set a search
# if you have custom userparams that need binaries elsewhere.
#
. /etc/rc.subr
name="zabbix_agentd"
rcvar=zabbix_agentd_enable
load_rc_config $name
: ${zabbix_agentd_enable:=NO}
: ${zabbix_agentd_config:=%%ETCDIR%%/${name}.conf}
: ${zabbix_agentd_pidfile:=/var/run/zabbix/zabbix_agentd.pid}
: ${zabbix_agentd_paths:=$PATH}
command="%%PREFIX%%/sbin/${name}"
required_files="${zabbix_agentd_config}"
start_cmd=zabbix_agentd_cmd
start_precmd=zabbix_agentd_precmd
status_precmd=zabbix_agentd_precmd
stop_precmd=zabbix_agentd_precmd
zabbix_agentd_precmd()
{
pidfile=${zabbix_agentd_pidfile}
if get_pidfile_from_conf PidFile ${zabbix_agentd_config}; then
pidfile="$_pidfile_from_conf"
fi
logfile=/var/log/zabbix/zabbix_agentd.log
if get_pidfile_from_conf LogFile ${zabbix_agentd_config}; then
logfile="$_pidfile_from_conf"
fi
local rundir=${pidfile%/*}
local logdir=${logfile%/*}
[ -d $rundir ] || install -d -m 0755 -o zabbix -g zabbix $rundir
[ -d $logdir ] || install -d -m 0755 -o zabbix -g zabbix $logdir
# This shouldn't be necessary with pidfile, but empirically it was the
# only way to reap the parent PID instead of all PIDs from
# check_process, which may leak SysV IPC objects and prevent restart
# and/or race condition on restart.
rc_pid=$(check_pidfile ${pidfile} ${command})
}
zabbix_agentd_cmd()
{
PATH=$zabbix_agentd_paths $command -c $zabbix_agentd_config
}
run_rc_command "$1"