Lines 9-18
Link Here
|
9 |
# |
9 |
# |
10 |
# zabbix_agentd_enable (bool): Set to NO by default. Set it to YES to |
10 |
# zabbix_agentd_enable (bool): Set to NO by default. Set it to YES to |
11 |
# enable zabbix_agentd. |
11 |
# enable zabbix_agentd. |
12 |
# zabbix_agentd_paths (string): Set to standard path by default. Set a search |
|
|
13 |
# if you have custom userparams that need binaries elsewhere. |
14 |
# zabbix_agentd_config (string): Set to the standard config file path by |
12 |
# zabbix_agentd_config (string): Set to the standard config file path by |
15 |
# default. |
13 |
# default. |
|
|
14 |
# zabbix_agentd_pidfile (string): Location of the asterisk pid file |
15 |
# Default is /var/run/zabbix/zabbix_agentd.pid |
16 |
# |
16 |
# |
17 |
|
17 |
|
18 |
. /etc/rc.subr |
18 |
. /etc/rc.subr |
Lines 20-46
Link Here
|
20 |
name="zabbix_agentd" |
20 |
name="zabbix_agentd" |
21 |
rcvar=zabbix_agentd_enable |
21 |
rcvar=zabbix_agentd_enable |
22 |
|
22 |
|
23 |
command="%%PREFIX%%/sbin/${name}" |
|
|
24 |
required_files="%%ETCDIR%%/${name}.conf" |
25 |
|
26 |
load_rc_config $name |
23 |
load_rc_config $name |
27 |
|
24 |
|
28 |
: ${zabbix_agentd_enable="NO"} |
25 |
: ${zabbix_agentd_enable:=NO} |
29 |
: ${zabbix_agentd_paths=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin} |
26 |
: ${zabbix_agentd_config:=%%ETCDIR%%/${name}.conf} |
30 |
: ${zabbix_agentd_config="%%ETCDIR%%/${name}.conf"} |
27 |
: ${zabbix_agentd_pidfile:=/var/run/zabbix/zabbix_agentd.pid} |
31 |
|
28 |
|
32 |
command="%%PREFIX%%/sbin/${name}" |
29 |
command="%%PREFIX%%/sbin/${name}" |
33 |
required_files="${zabbix_agentd_config}" |
30 |
required_files="${zabbix_agentd_config}" |
34 |
start_precmd="find_pidfile" |
|
|
35 |
status_precmd="find_pidfile" |
36 |
stop_precmd="find_pidfile" |
37 |
|
31 |
|
38 |
find_pidfile() |
32 |
start_precmd=zabbix_agentd_precmd |
|
|
33 |
status_precmd=zabbix_agentd_precmd |
34 |
stop_precmd=zabbix_agentd_precmd |
35 |
|
36 |
zabbix_agentd_precmd() |
39 |
{ |
37 |
{ |
40 |
if get_pidfile_from_conf PidFile ${zabbix_agentd_config}; then |
38 |
if get_pidfile_from_conf PidFile ${zabbix_agentd_config}; then |
41 |
pidfile="$_pidfile_from_conf" |
39 |
pidfile="$_pidfile_from_conf" |
42 |
else |
40 |
else |
43 |
pidfile="/tmp/${name}.pid" |
41 |
pidfile=${zabbix_agentd_pidfile} |
|
|
42 |
local rundir=${zabbix_agentd_pidfile%/*} |
43 |
if [ ! -d $rundir ] ; then |
44 |
install -d -m 0755 -o zabbix -g zabbix $rundir |
45 |
fi |
44 |
fi |
46 |
fi |
45 |
|
47 |
|
46 |
# This shouldn't be necessary with pidfile, but empirically it was the |
48 |
# This shouldn't be necessary with pidfile, but empirically it was the |
Lines 50-55
Link Here
|
50 |
rc_pid=$(check_pidfile ${pidfile} ${command}) |
52 |
rc_pid=$(check_pidfile ${pidfile} ${command}) |
51 |
} |
53 |
} |
52 |
|
54 |
|
53 |
export PATH="${zabbix_agentd_paths}" |
|
|
54 |
|
55 |
run_rc_command "$1" |
55 |
run_rc_command "$1" |