ports/databases/tarantool/files/tarantool.in
Veniamin Gvozdikov 83c061b97e - Update to new version
- Fixed bugs at init script
- Added auto init storage at init script
- Added more information at pkg-message
- Groupped plugins

Submitted by:	myself
2013-11-23 08:47:39 +00:00

53 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
# PROVIDE: tarantool
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# tarantool_enable="YES"
# tarantool_config=""
# tarantool_data="/var/db/tarantool"
#
. /etc/rc.subr
name="tarantool"
rcvar=tarantool_enable
load_rc_config "$name"
tarantool_enable=${tarantool_enable:-"NO"}
tarantool_config=${tarantool_config:-"%%ETCDIR%%/$name.cfg"}
tarantool_data=${tarantool_data:-"/var/db/tarantool"}
command="%%PREFIX%%/bin/tarantool_box"
command_args="--config=${tarantool_config} --background"
pidfile="/var/run/$name.pid"
start_precmd="${name}_prestart"
tarantool_prestart()
{
if ! [ -d ${tarantool_data} ]
then
eval mkdir -p ${tarantool_data}
fi
if ! [ -f "${tarantool_data}/00000000000000000001.snap" ]
then
if ! [ -f ${tarantool_config} ]
then
echo "===> Install default config file."
eval cp "%%ETCDIR%%/tarantool.cfg.sample" ${tarantool_config}
echo "===> Install default snapshot."
eval cp "%%DATADIR%%/00000000000000000001.snap" ${tarantool_data}
else
echo "===> Init tarantool storage by ${tarantool_config}"
eval ${command} --config=${tarantool_config} --init-storage
fi
fi
}
run_rc_command "$1"