/[smecontribs]/rpms/zabbix/contribs9/zabbix-java-gateway.init
ViewVC logotype

Contents of /rpms/zabbix/contribs9/zabbix-java-gateway.init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu May 14 03:38:48 2020 UTC (4 years, 6 months ago) by jpp
Branch: MAIN
CVS Tags: zabbix-4_4_6-2_el6_sme, zabbix-4_4_6-1_el6_sme, zabbix-4_4_6-1_el6, HEAD
import

1 #! /bin/sh
2 #
3 # chkconfig: - 85 15
4 # description: zabbix java gateway
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 java gateway
14 # Description: Zabbix Java Gateway
15 ### END INIT INFO
16
17 # Source function library.
18 . /etc/rc.d/init.d/functions
19
20 # Source networking configuration.
21 . /etc/sysconfig/network
22
23 # Source Zabbix Java Gateway configuration
24 . /etc/zabbix/zabbix_java_gateway.conf
25
26 if [ -r "/etc/sysconfig/zabbix-java-gateway" ]; then
27 . /etc/sysconfig/zabbix-java-gateway
28 fi
29
30 # Check that networking is up.
31 [ ${NETWORKING} = "no" ] && exit 0
32
33 RETVAL=0
34 EXECDIR=/usr/sbin/zabbix_java
35
36 case "$1" in
37 start)
38 echo -n "Starting zabbix java gateway: "
39 if [ -n "$PID_FILE" -a -e "$PID_FILE" ]; then
40 echo "zabbix java gateway is already running"
41 exit 1
42 fi
43
44 JAVA=${JAVA:-java}
45
46 JAVA_OPTIONS="-server $JAVA_OPTIONS"
47 if [ -z "$PID_FILE" ]; then
48 JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console.xml"
49 fi
50
51 cd $EXECDIR
52
53 CLASSPATH="lib"
54 for jar in {lib,bin}/*.jar; do
55 if [[ $jar != *junit* ]]; then
56 CLASSPATH="$CLASSPATH:$jar"
57 fi
58 done
59
60 if [ -n "$PID_FILE" ]; then
61 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.pidFile=$PID_FILE"
62 fi
63 if [ -n "$LISTEN_IP" ]; then
64 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$LISTEN_IP"
65 fi
66 if [ -n "$LISTEN_PORT" ]; then
67 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$LISTEN_PORT"
68 fi
69 if [ -n "$START_POLLERS" ]; then
70 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$START_POLLERS"
71 fi
72 if [ -n "$TIMEOUT" ]; then
73 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$TIMEOUT"
74 fi
75
76 tcp_timeout=${TIMEOUT:=3}000
77 ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout"
78
79 COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"
80
81 if [ -n "$PID_FILE" ]; then
82 PID=$(su -s /bin/bash -c "$COMMAND_LINE > /dev/null 2>&1 & echo \$!" zabbix)
83 if ps -p $PID > /dev/null 2>&1; then
84 echo $PID > $PID_FILE
85 else
86 echo "zabbix java gateway did not start"
87 exit 1
88 fi
89 else
90 exec $COMMAND_LINE
91 RETVAL=$?
92 fi
93 ;;
94 stop)
95 echo -n "Shutting down zabbix java gateway: "
96 if [ -n "$PID_FILE" ]; then
97 if [ -e "$PID_FILE" ]; then
98 kill `cat $PID_FILE` && rm $PID_FILE
99 else
100 echo "zabbix java gateway is not running"
101 exit 1
102 fi
103 else
104 echo "zabbix java gateway is not configured as a daemon: variable \$PID_FILE is not set"
105 exit 1
106 fi
107 ;;
108 restart)
109 $0 stop
110 $0 start
111 RETVAL=$?
112 ;;
113 condrestart)
114 if [ -n "$PID_FILE" -a -e "$PID_FILE" ]; then
115 $0 stop
116 $0 start
117 fi
118 RETVAL=$?
119 ;;
120 status)
121 status -p $PID_FILE $0
122 RETVAL=$?
123 exit $RETVAL
124 ;;
125 *)
126 echo "Usage: $0 {start|stop|restart|condrestart|status}"
127 exit 1
128 ;;
129 esac
130
131 [ "$RETVAL" -eq 0 ] && success $"$base startup" || failure $"$base startup"
132 echo
133 exit $RETVAL
134

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed