]> TLD Linux GIT Repositories - packages/zabbix.git/blob - zabbix_proxy.init
- updated to 6.0.29
[packages/zabbix.git] / zabbix_proxy.init
1 #!/bin/sh
2 #
3 # Starts the zabbix_proxy daemon
4 #
5 # chkconfig:    345 95 5
6 #
7 # description:  zabbix_proxy long service description
8 #
9 # processname:  zabbix_proxy
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20                 msg_network_down "Zabbix Proxy"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 # Get service config - may override defaults
28 [ -f /etc/sysconfig/zabbix_proxy ] && . /etc/sysconfig/zabbix_proxy
29
30 pidfile="/var/run/zabbix/zabbix_proxy.pid"
31
32 start() {
33         # Check if the service is already running?
34         if [ -f /var/lock/subsys/zabbix_proxy ]; then
35                 msg_already_running "Zabbix Proxy"
36                 return
37         fi
38
39         msg_starting "Zabbix Proxy"
40         daemon /usr/sbin/zabbix_proxy
41         RETVAL=$?
42         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_proxy
43 }
44
45 stop() {
46         if [ ! -f /var/lock/subsys/zabbix_proxy ]; then
47                 msg_not_running "Zabbix Proxy"
48                 return
49         fi
50
51         # Stop daemons.
52         msg_stopping "Zabbix Proxy"
53         killproc --pidfile $pidfile zabbix_proxy -TERM
54         rm -f /var/lock/subsys/zabbix_proxy
55 }
56
57 condrestart() {
58         if [ ! -f /var/lock/subsys/zabbix_proxy ]; then
59                 msg_not_running "Zabbix Proxy"
60                 RETVAL=$1
61                 return
62         fi
63
64         stop
65         start
66 }
67
68 RETVAL=0
69 # See how we were called.
70 case "$1" in
71   start)
72         start
73         ;;
74   stop)
75         stop
76         ;;
77   restart)
78         stop
79         start
80         ;;
81   try-restart)
82         condrestart 0
83         ;;
84   force-reload)
85         condrestart 7
86         ;;
87   status)
88         status --pidfile $pidfile zabbix_proxy
89         RETVAL=$?
90         ;;
91   *)
92         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
93         exit 3
94 esac
95
96 exit $RETVAL