blob: 19a793b2c96a5547177fb6fa728f27e8bb4602d7 (
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
|
#!/bin/sh
# PROVIDE: tarantool
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# tarantool_enable="YES"
# tarantool_instances=""
#
. /etc/rc.subr
name="tarantool"
rcvar=tarantool_enable
load_rc_config "$name"
tarantool_enable=${tarantool_enable:-"NO"}
tarantool_instances=${tarantool_instances:-"%%ETCDIR%%/instances.enabled"}
start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"
INSTANCES=$(find ${tarantool_instances} -type l -name '*.lua' 2>/dev/null)
TDAEMON=%%PREFIX%%/bin/tarantool
TCTL=%%PREFIX%%/bin/tarantoolctl
tarantool_start()
{
echo "tarantool: Starting instances"
for inst in ${INSTANCES}
do
${TDAEMON} ${TCTL} start $(basename ${inst} .lua)
done
}
tarantool_stop()
{
echo "tarantool: Stopping instances"
for inst in ${INSTANCES}
do
${TDAEMON} ${TCTL} stop $(basename ${inst} .lua)
done
}
tarantool_restart()
{
tarantool_stop
tarantool_start
}
run_rc_command "$1"
|