File: tarantool.init

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (108 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download | duplicates (5)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /bin/sh
# /etc/init.d/tarantool
### BEGIN INIT INFO
# Provides:          tarantool
# 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:bin
SCRIPTNAME=/etc/init.d/tarantool
DAEMON=/usr/bin/tarantool
DIST_LUA=/usr/bin/tarantoolctl

if [ -e "/lib/lsb/init-functions" ]; then
	. /lib/lsb/init-functions
fi

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

if [ -e "/lib/init/vars.sh" ]; then
    . /lib/init/vars.sh
elif [ -e "/etc/rc.d/init.d/functions" ]; then
    . /etc/rc.d/init.d/functions
fi

if [ -e "/etc/sysconfig/tarantool" ]; then
    sysconfig_tarantool="/etc/sysconfig/tarantool"
elif [ -e "/etc/default/tarantool" ]; then
    sysconfig_tarantool="/etc/default/tarantool"
fi

if [ -n "$sysconfig_tarantool" ]; then
    CONF_DIR=`echo "dofile('$sysconfig_tarantool') print(instance_dir)" | tarantool`
fi

if [ -z "$sysconfig_tarantool" -o "$CONF_DIR" = "nil" ]; then
    CONF_DIR="/etc/tarantool/instances.enabled"
fi

INSTANCES=`find $CONF_DIR -xtype f -name '*lua'`

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

#
# Function that starts the daemon/service
#
do_start() {
    echo "tarantool: Starting instances"
    for inst in $INSTANCES; do
        $DAEMON $DIST_LUA start `basename $inst .lua`
    done
    return 0
}

#
# Function that stops the daemon/service
#
do_stop() {
    echo "tarantool: Stopping instances"
    for inst in $INSTANCES; do
        $DAEMON $DIST_LUA stop `basename $inst .lua`
    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

: