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