#!/sbin/openrc-run

INSTANCE=default
[ "${RC_SVCNAME}" != "${RC_SVCNAME##*.}" ] && INSTANCE=${RC_SVCNAME##*.}
command="/usr/bin/tarantoolctl"
command_user="${TARANTOOL_USER:-tarantool}"
command_args="start ${INSTANCE}"
pidfile="/run/${INSTANCE}.pid"

depend() {
        use logger dns
        need net
        after firewall
}

start_pre() {
	checkpath --owner ${TARANTOOL_USER:-tarantool}:${TARANTOOL_USER:-tarantool} \
		--directory --mode 0775 /var/log/tarantool /var/run/tarantool
}
