1 |
jpp |
1.2 |
#!/bin/sh |
2 |
jpp |
1.1 |
# |
3 |
|
|
# chkconfig: - 85 15 |
4 |
jpp |
1.2 |
# description: Zabbix server daemon |
5 |
|
|
# config: /etc/zabbix/zabbix_server.conf |
6 |
jpp |
1.1 |
# |
7 |
|
|
|
8 |
|
|
### BEGIN INIT INFO |
9 |
|
|
# Provides: zabbix |
10 |
|
|
# Required-Start: $local_fs $network |
11 |
|
|
# Required-Stop: $local_fs $network |
12 |
|
|
# Default-Start: |
13 |
|
|
# Default-Stop: 0 1 2 3 4 5 6 |
14 |
jpp |
1.2 |
# Short-Description: Start and stop Zabbix server |
15 |
|
|
# Description: Zabbix server |
16 |
jpp |
1.1 |
### END INIT INFO |
17 |
|
|
|
18 |
jpp |
1.2 |
# Source function library. |
19 |
|
|
. /etc/rc.d/init.d/functions |
20 |
|
|
|
21 |
|
|
if [ -x /usr/sbin/zabbix_server ]; then |
22 |
|
|
exec=/usr/sbin/zabbix_server |
23 |
jpp |
1.1 |
else |
24 |
|
|
exit 5 |
25 |
|
|
fi |
26 |
|
|
|
27 |
jpp |
1.2 |
prog=${exec##*/} |
28 |
|
|
conf=/etc/zabbix/zabbix_server.conf |
29 |
|
|
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r') |
30 |
|
|
timeout=10 |
31 |
jpp |
1.1 |
|
32 |
jpp |
1.2 |
if [ -f /etc/sysconfig/zabbix-server ]; then |
33 |
|
|
. /etc/sysconfig/zabbix-server |
34 |
|
|
fi |
35 |
jpp |
1.1 |
|
36 |
jpp |
1.2 |
lockfile=/var/lock/subsys/zabbix-server |
37 |
jpp |
1.1 |
|
38 |
jpp |
1.2 |
start() |
39 |
|
|
{ |
40 |
|
|
echo -n $"Starting Zabbix server: " |
41 |
|
|
daemon $exec -c $conf |
42 |
|
|
rv=$? |
43 |
|
|
echo |
44 |
|
|
[ $rv -eq 0 ] && touch $lockfile |
45 |
|
|
return $rv |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
stop() |
49 |
|
|
{ |
50 |
|
|
echo -n $"Shutting down Zabbix server: " |
51 |
|
|
killproc -p $pidfile -d $timeout $prog |
52 |
|
|
rv=$? |
53 |
|
|
echo |
54 |
|
|
[ $rv -eq 0 ] && rm -f $lockfile |
55 |
|
|
return $rv |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
restart() |
59 |
|
|
{ |
60 |
|
|
stop |
61 |
|
|
start |
62 |
|
|
} |
63 |
jpp |
1.1 |
|
64 |
|
|
case "$1" in |
65 |
jpp |
1.2 |
start|stop|restart) |
66 |
|
|
$1 |
67 |
|
|
;; |
68 |
|
|
force-reload) |
69 |
|
|
restart |
70 |
jpp |
1.1 |
;; |
71 |
jpp |
1.2 |
status) |
72 |
|
|
status -p $pidfile $prog |
73 |
jpp |
1.1 |
;; |
74 |
jpp |
1.2 |
try-restart|condrestart) |
75 |
|
|
if status $prog >/dev/null ; then |
76 |
|
|
restart |
77 |
|
|
fi |
78 |
jpp |
1.1 |
;; |
79 |
jpp |
1.2 |
reload) |
80 |
|
|
action $"Service ${0##*/} does not support the reload action: " /bin/false |
81 |
|
|
exit 3 |
82 |
jpp |
1.1 |
;; |
83 |
|
|
*) |
84 |
jpp |
1.2 |
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" |
85 |
|
|
exit 2 |
86 |
jpp |
1.1 |
;; |
87 |
|
|
esac |
88 |
|
|
|