File: tarantool-lts-common.tarantool-lts.init

package info (click to toggle)
tarantool-lts 1.5.5.37.g1687c02-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 15,124 kB
  • ctags: 18,819
  • sloc: ansic: 118,797; cpp: 22,178; sh: 18,496; xml: 10,692; python: 2,083; java: 1,759; perl: 972; makefile: 719; ruby: 84
file content (89 lines) | stat: -rw-r--r-- 1,639 bytes parent folder | download
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
80
81
82
83
84
85
86
87
88
89
#! /bin/sh
# /etc/init.d/tarantool-lts
### BEGIN INIT INFO
# Provides:          tarantool-lts
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Tarantool init script
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: Dmitry E. Oboukhov <unera@debian.org>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
CONF_DIR=/etc/tarantool/instances.enabled
SCRIPTNAME=/etc/init.d/tarantool
DAEMON=/usr/bin/tarantool_box
INSTANCES=`find $CONF_DIR -xtype f -name '*.cfg'`
INSTSCRIPT=/usr/sbin/tarantool_instance

. /lib/lsb/init-functions

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

. /lib/init/vars.sh

if test -z "$INSTANCES"; then
    echo "tarantool: There are no instances in $CONF_DIR"
    exit 0
fi


#
# Function that starts the daemon/service
#
do_start() {
    echo "tarantool: Staring instances"
    for inst in $INSTANCES; do
        $INSTSCRIPT $inst start
    done
    return 0
}

#
# Function that stops the daemon/service
#
do_stop() {
    echo "tarantool: Stopping instances"
    for inst in $INSTANCES; do
        $INSTSCRIPT $inst stop
    done
    return 0
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    do_stop
    do_start
}

case "$1" in
    start)
        do_start
    ;;

    stop)
        do_stop
    ;;

    status)
    ;;

    restart|force-reload)
        do_stop
        do_start
    ;;
    
    *)
	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
	exit 3
    ;;
esac

: