summaryrefslogtreecommitdiff
path: root/databases/tarantool2/files/tarantool.in
diff options
context:
space:
mode:
authorPavel Balaev <mail@void.so>2023-12-29 14:38:02 +0300
committerGleb Popov <arrowd@FreeBSD.org>2023-12-29 23:10:53 +0300
commit1251766a70bf28970936cf4dcf7c32b5e519339a (patch)
treeb0f02f3f55318e628ce7f14f8089eb8569587a24 /databases/tarantool2/files/tarantool.in
parentgraphics/nvidia-drm-515-kmod: Fix build on CURRENT with iosys-map.h (diff)
databases/tarantool: Renamed to tarantool2
A new major version of the tarantool has been released. databases/tarantool renamed to databases/tarantool2. 2.11 is an LTS version and it is advisable to leave the option to install it. Signed-off-by: Pavel Balaev <mail@void.so>
Diffstat (limited to 'databases/tarantool2/files/tarantool.in')
-rw-r--r--databases/tarantool2/files/tarantool.in53
1 files changed, 53 insertions, 0 deletions
diff --git a/databases/tarantool2/files/tarantool.in b/databases/tarantool2/files/tarantool.in
new file mode 100644
index 000000000000..19a793b2c96a
--- /dev/null
+++ b/databases/tarantool2/files/tarantool.in
@@ -0,0 +1,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"