summaryrefslogtreecommitdiffstats
path: root/misc/init.d/fedora/core5/zabbix_server
blob: cf2e7dfb1513bff536a898aae992718e97715090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#
#       /etc/rc.d/init.d/dovecot
#
# Starts the zabbix_server daemon
#
# chkconfig: - 95 5
# description: Zabbix Monitoring Server
# processname: zabbix_server
# pidfile: /var/tmp/zabbix_server.pid

# Source function library.

. /etc/init.d/functions

RETVAL=0
prog="Zabbix Server"
CONFIG_FILE="/etc/zabbix/zabbix_server.conf"
ZABBIX_BIN="/usr/bin/zabbix_server"

test -x $ZABBIX_BIN || exit 0

if [ ! -f ${CONFIG_FILE} ]; then
                echo -n "${NAME}configuration file ${CONFIG_FILE} does not exist. "
                # Tell the user this has skipped
                exit 6
fi

if [ ! -x ${ZABBIX_BIN} ] ; then
        echo -n "${ZABBIX_BIN} not installed! "
        # Tell the user this has skipped
        exit 5
fi

start() {
        echo -n $"Starting $prog: "
        daemon $ZABBIX_BIN -c $CONFIG_FILE
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_server
        echo
}

stop() {
        echo -n $"Stopping $prog: "
        killproc $ZABBIX_BIN
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix_server
        echo
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  reload|restart)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/zabbix_server ]; then
            stop
            start
        fi
        ;;
  status)
        status $ZABBIX_BIN
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}"
        exit 1
esac

exit $RETVAL