1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-02 01:20:54 +00:00
freebsd-ports/devel/hadoop/files/secondarynamenode.in
Clement Laforet 95b1c2e57b - Add hadoop 1.0.0
- Add hadoop user to GIDs/UIDs (955)

The Apache Hadoop software library is a framework that allows for the
distributed processing of large data sets across clusters of computers
using a simple programming model.

WWW: http://hadoop.apache.org/

Approved by:    culot@, jadawin@ (mentors)
Feature safe:   yes
2012-03-27 14:51:01 +00:00

73 lines
1.9 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: secondarynamenode
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable this service:
#
# secondarynamenode_enable (bool): Set to NO by default.
# Set it to YES to enable secondarynamenode.
# secondarynamenode_user (str): Set to %%HADOOP_USER%% by default.
# Set to a valid user to change default
# secondarynamenode user.
# secondarynamenode_java_home (str): Unset by default.
# Switch to another JVM.
#
# secondarynamenode_log_dir (str): Unset by default.
# secondarynamenode_pid_dir (str): Unset by default.
#
. /etc/rc.subr
name=secondarynamenode
rcvar=secondarynamenode_enable
load_rc_config "${name}"
: ${secondarynamenode_enable:=NO}
: ${secondarynamenode_user:=%%HADOOP_USER%%}
: ${secondarynamenode_group:=%%HADOOP_GROUP%%}
command="%%HADOOP_HOME%%/bin/hadoop-daemon.sh"
command_args='--config ${HADOOP_CONF_DIR} start secondarynamenode'
start_precmd=secondarynamenode_init
stop_precmd=secondarynamenode_init
stop_cmd=secondarynamenode_stop
secondarynamenode_init()
{
if [ -n "${secondarynamenode_java_home}" ]
then
export JAVA_HOME="${secondarynamenode_java_home}"
fi
for f in %%HADOOP_ETC%%/envvars.d/*.env
do
. ${f}
done
if [ -n "${secondarynamenode_log_dir}" ]
then
HADOOP_LOG_DIR=${secondarynamenode_log_dir}
fi
if [ -n "${secondarynamenode_pid_dir}" ]
then
HADOOP_LOG_DIR=${secondarynamenode_pid_dir}
fi
install -d -m 755 -o ${secondarynamenode_user} -g ${secondarynamenode_group} ${HADOOP_PID_DIR}
install -d -m 755 -o ${secondarynamenode_user} -g ${secondarynamenode_group} ${HADOOP_LOG_DIR}
}
secondarynamenode_stop ()
{
su -m ${secondarynamenode_user} -c "${command} --config ${HADOOP_CONF_DIR} stop secondarynamenode"
}
run_rc_command "$1"