1 |
slords |
1.1 |
#! /bin/sh |
2 |
|
|
# |
3 |
|
|
# chkconfig: - 85 15 |
4 |
|
|
# description: zabbix proxy daemon |
5 |
|
|
# |
6 |
|
|
|
7 |
|
|
### BEGIN INIT INFO |
8 |
|
|
# Provides: zabbix |
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 proxy |
14 |
|
|
# Description: Zabbix Proxy |
15 |
|
|
### END INIT INFO |
16 |
|
|
|
17 |
|
|
# zabbix details |
18 |
|
|
if [ -x /usr/sbin/zabbix_proxy_mysql ]; then |
19 |
|
|
ZABBIX_PROXY=zabbix_proxy_mysql |
20 |
|
|
elif [ -x /usr/sbin/zabbix_proxy_pgsql ]; then |
21 |
|
|
ZABBIX_PROXY=zabbix_proxy_pgsql |
22 |
|
|
elif [ -x /usr/sbin/zabbix_proxy_sqlite3 ]; then |
23 |
|
|
ZABBIX_PROXY=zabbix_proxy_sqlite3 |
24 |
|
|
else |
25 |
|
|
exit 5 |
26 |
|
|
fi |
27 |
|
|
|
28 |
|
|
CONF=/etc/zabbix/zabbix_proxy.conf |
29 |
|
|
PIDFILE=/var/run/zabbix.pid |
30 |
|
|
|
31 |
|
|
# Source function library. |
32 |
|
|
. /etc/rc.d/init.d/functions |
33 |
|
|
|
34 |
|
|
# Source networking configuration. |
35 |
|
|
. /etc/sysconfig/network |
36 |
|
|
|
37 |
|
|
# Check that networking is up. |
38 |
|
|
[ ${NETWORKING} = "no" ] && exit 0 |
39 |
|
|
|
40 |
|
|
[ -e $CONF ] || exit 6 |
41 |
|
|
|
42 |
|
|
RETVAL=0 |
43 |
|
|
|
44 |
|
|
case "$1" in |
45 |
|
|
start) |
46 |
|
|
echo -n "Starting Zabbix proxy: " |
47 |
|
|
daemon $ZABBIX_PROXY -c $CONF |
48 |
|
|
RETVAL=$? |
49 |
|
|
echo |
50 |
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix-proxy |
51 |
|
|
;; |
52 |
|
|
stop) |
53 |
|
|
echo -n "Shutting down Zabbix proxy: " |
54 |
|
|
killproc $ZABBIX_PROXY |
55 |
|
|
RETVAL=$? |
56 |
|
|
echo |
57 |
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix-proxy |
58 |
|
|
;; |
59 |
|
|
restart|reload) |
60 |
|
|
$0 stop |
61 |
|
|
$0 start |
62 |
|
|
RETVAL=$? |
63 |
|
|
;; |
64 |
|
|
status) |
65 |
|
|
status $ZABBIX_PROXY |
66 |
|
|
RETVAL=$? |
67 |
|
|
;; |
68 |
|
|
*) |
69 |
|
|
echo "Usage: $0 {start|stop|restart|reload|status}" |
70 |
|
|
exit 1 |
71 |
|
|
;; |
72 |
|
|
esac |
73 |
|
|
|
74 |
|
|
exit $RETVAL |
75 |
|
|
|