Changeset View
Changeset View
Standalone View
Standalone View
net-mgmt/zabbix5-server/files/zabbix_agentd.in
Show All 33 Lines | |||||
start_cmd=zabbix_agentd_cmd | start_cmd=zabbix_agentd_cmd | ||||
start_precmd=zabbix_agentd_precmd | start_precmd=zabbix_agentd_precmd | ||||
status_precmd=zabbix_agentd_precmd | status_precmd=zabbix_agentd_precmd | ||||
stop_precmd=zabbix_agentd_precmd | stop_precmd=zabbix_agentd_precmd | ||||
zabbix_agentd_precmd() | zabbix_agentd_precmd() | ||||
{ | { | ||||
pidfile=${zabbix_agentd_pidfile} | |||||
if get_pidfile_from_conf PidFile ${zabbix_agentd_config}; then | if get_pidfile_from_conf PidFile ${zabbix_agentd_config}; then | ||||
pidfile="$_pidfile_from_conf" | pidfile="$_pidfile_from_conf" | ||||
else | |||||
pidfile=${zabbix_agentd_pidfile} | |||||
local rundir=${zabbix_agentd_pidfile%/*} | |||||
if [ ! -d $rundir ] ; then | |||||
install -d -m 0755 -o zabbix -g zabbix $rundir | |||||
fi | fi | ||||
logfile=/var/log/zabbix/zabbix_agentd.log | |||||
if get_pidfile_from_conf LogFile ${zabbix_agentd_config}; then | |||||
logfile="$_pidfile_from_conf" | |||||
fi | 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 | # This shouldn't be necessary with pidfile, but empirically it was the | ||||
# only way to reap the parent PID instead of all PIDs from | # only way to reap the parent PID instead of all PIDs from | ||||
# check_process, which may leak SysV IPC objects and prevent restart | # check_process, which may leak SysV IPC objects and prevent restart | ||||
# and/or race condition on restart. | # and/or race condition on restart. | ||||
rc_pid=$(check_pidfile ${pidfile} ${command}) | rc_pid=$(check_pidfile ${pidfile} ${command}) | ||||
} | } | ||||
zabbix_agentd_cmd() | zabbix_agentd_cmd() | ||||
{ | { | ||||
PATH=$zabbix_agentd_paths $command -c $zabbix_agentd_config | PATH=$zabbix_agentd_paths $command -c $zabbix_agentd_config | ||||
} | } | ||||
run_rc_command "$1" | run_rc_command "$1" |