ports/devel/hive/files/hiveserver2.in
2015-10-23 13:30:29 +00:00

39 lines
944 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: hiveserver2
# REQUIRE: LOGIN metastore
# KEYWORD: shutdown
#
# hiveserver2_enable (bool): Set to NO by default.
# Set it to YES to enable HiveServer2.
. /etc/rc.subr
export PATH=${PATH}:%%LOCALBASE%%/bin
name=hiveserver2
rcvar=hiveserver2_enable
pidfile=%%HIVE_RUNDIR%%/${name}.pid
load_rc_config "${name}"
: ${hiveserver2_enable:=NO}
hiveserver2_user=%%HIVE_USER%%
start_cmd="hiveserver2_start"
stop_cmd="hiveserver2_stop"
command="%%PREFIX%%/hive/bin/hive"
hiveserver2_start() {
su -m %%HIVE_USER%% -c "HADOOP_OPTS=\"-Dhive.log.dir=%%HIVE_LOGDIR%% -Dhive.log.file=hiveserver2.log -Dhive.log.threshold=INFO\" $command --service $name > %%HIVE_LOGDIR%%/$name.out 2>&1 < /dev/null & "' echo $! '"> $pidfile"
}
hiveserver2_stop() {
rc_pid=$(check_pidfile ${pidfile} %%JAVA_HOME%%/bin/java)
if [ -n "$rc_pid" ]; then
kill $rc_pid
fi
}
run_rc_command "$1"