1 |
jpp |
1.1 |
#! /bin/sh |
2 |
|
|
# |
3 |
|
|
# chkconfig: - 85 15 |
4 |
|
|
# description: zabbix agent daemon |
5 |
|
|
# |
6 |
|
|
|
7 |
|
|
### BEGIN INIT INFO |
8 |
|
|
# Provides: zabbix-agent |
9 |
|
|
# Required-Start: $local_fs $network |
10 |
|
|
# Required-Stop: $local_fs $network |
11 |
|
|
# Default-Start: |
12 |
|
|
# Default-Stop: 0 1 2 3 4 5 6 |
13 |
|
|
# Short-Description: start and stop zabbix agent |
14 |
|
|
# Description: Zabbix Agent |
15 |
|
|
### END INIT INFO |
16 |
|
|
|
17 |
|
|
# zabbix details |
18 |
|
|
ZABBIX_AGENTD=/usr/sbin/zabbix_agentd |
19 |
|
|
CONF=/etc/zabbix/zabbix_agentd.conf |
20 |
|
|
PIDFILE=/var/run/zabbix-agent.pid |
21 |
|
|
|
22 |
|
|
# Source function library. |
23 |
|
|
. /etc/rc.d/init.d/functions |
24 |
|
|
|
25 |
|
|
# Source networking configuration. |
26 |
|
|
. /etc/sysconfig/network |
27 |
|
|
|
28 |
|
|
# Check that networking is up. |
29 |
|
|
[ ${NETWORKING} = "no" ] && exit 0 |
30 |
|
|
|
31 |
|
|
[ -x $ZABBIX_AGENTD ] || exit 5 |
32 |
|
|
[ -e $CONF ] || exit 6 |
33 |
|
|
|
34 |
|
|
RETVAL=0 |
35 |
|
|
|
36 |
|
|
case "$1" in |
37 |
|
|
start) |
38 |
|
|
echo -n "Starting zabbix agent: " |
39 |
|
|
daemon $ZABBIX_AGENTD -c $CONF |
40 |
|
|
RETVAL=$? |
41 |
|
|
echo |
42 |
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix-agent |
43 |
|
|
;; |
44 |
|
|
stop) |
45 |
|
|
echo -n "Shutting down zabbix agent: " |
46 |
|
|
killproc zabbix_agentd |
47 |
|
|
RETVAL=$? |
48 |
|
|
echo |
49 |
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix-agent |
50 |
|
|
;; |
51 |
|
|
restart|reload) |
52 |
|
|
$0 stop |
53 |
|
|
$0 start |
54 |
|
|
RETVAL=$? |
55 |
|
|
;; |
56 |
|
|
status) |
57 |
|
|
status zabbix_agentd |
58 |
|
|
RETVAL=$? |
59 |
|
|
;; |
60 |
|
|
*) |
61 |
|
|
echo "Usage: $0 {start|stop|restart|reload|status}" |
62 |
|
|
exit 1 |
63 |
|
|
;; |
64 |
|
|
esac |
65 |
|
|
|
66 |
|
|
exit $RETVAL |
67 |
|
|
|