File: zabbix-server-mysql.zabbix-server.init

package info (click to toggle)
zabbix 1%3A4.0.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 83,104 kB
  • sloc: php: 162,280; ansic: 154,778; sql: 96,479; sh: 5,281; makefile: 1,340; java: 1,068; cpp: 227; perl: 41; xml: 29
file content (64 lines) | stat: -rw-r--r-- 1,744 bytes parent folder | download | duplicates (3)
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
#! /bin/sh
### BEGIN INIT INFO
# Provides:          zabbix-server
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Should-Start:      mysql
# Should-Stop:       mysql
# Short-Description: Start zabbix-server daemon
# Description: Start zabbix-server daemon (MySQL)
### END INIT INFO

NAME=zabbix_server
DAEMON=/usr/sbin/$NAME
# Exit if executable is not installed
[ -x $DAEMON ] || exit 0

DIR=/var/run/zabbix
PID=$DIR/$NAME.pid
RETRY=TERM/30/KILL/5

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# define LSB log_* functions.
. /lib/lsb/init-functions

_ev_ () {
  [ "$VERBOSE" = "no" ] || eval $@
}

[ -d "$DIR" ] || mkdir "$DIR"
chown -R zabbix:zabbix "$DIR"
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
    start-stop-daemon --start --pidfile $PID --exec $DAEMON --test --quiet > /dev/null
    [ $? -ne 0 ] && log_action_msg "$NAME is already running" && exit 0
    _ev_ log_action_begin_msg \"$NAME starting\"
    R=$(start-stop-daemon --start --pidfile $PID --exec $DAEMON --oknodo 2>&1) \
    && _ev_ log_action_end_msg 0 \"$R\" \
    || _ev_ log_action_end_msg 1 \"$R\"
  ;;
  stop)
    _ev_ log_action_begin_msg "$NAME stopping"
    R=$(start-stop-daemon --stop --pidfile $PID --exec $DAEMON --oknodo --retry=$RETRY 2>&1) \
    && _ev_ log_action_end_msg 0 \"$R\" \
    || _ev_ log_action_end_msg 1 \"$R\"
  ;;
  status)
    ## return status 0 if process is running.
    status_of_proc -p $PID "$DAEMON" "$NAME"
  ;;
  restart|force-reload)
    $0 stop
    $0 start
  ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
    exit 1
  ;;
esac