1 |
#! /bin/sh |
2 |
# |
3 |
# chkconfig: - 85 15 |
4 |
# description: zabbix server 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 server |
14 |
# Description: Zabbix Server |
15 |
### END INIT INFO |
16 |
|
17 |
# zabbix details |
18 |
if [ -x /usr/sbin/zabbix_server_mysql ]; then |
19 |
ZABBIX=zabbix_server_mysql |
20 |
elif [ -x /usr/sbin/zabbix_server_pgsql ]; then |
21 |
ZABBIX=zabbix_server_pgsql |
22 |
elif [ -x /usr/sbin/zabbix_server_sqlite3 ]; then |
23 |
ZABBIX=zabbix_server_sqlite3 |
24 |
else |
25 |
exit 5 |
26 |
fi |
27 |
|
28 |
CONF=/etc/zabbix/zabbix_server.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 server: " |
47 |
daemon $ZABBIX -c $CONF |
48 |
RETVAL=$? |
49 |
echo |
50 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix |
51 |
;; |
52 |
stop) |
53 |
echo -n "Shutting down zabbix server: " |
54 |
killproc $ZABBIX |
55 |
RETVAL=$? |
56 |
echo |
57 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix |
58 |
;; |
59 |
restart|reload) |
60 |
$0 stop |
61 |
$0 start |
62 |
RETVAL=$? |
63 |
;; |
64 |
status) |
65 |
status $ZABBIX |
66 |
RETVAL=$? |
67 |
;; |
68 |
*) |
69 |
echo "Usage: $0 {start|stop|restart|reload|status}" |
70 |
exit 1 |
71 |
;; |
72 |
esac |
73 |
|
74 |
exit $RETVAL |
75 |
|