#!/bin/sh # # $FreeBSD: head/devel/hadoop/files/namenode.in 360157 2014-07-02 08:52:14Z demon $ # # PROVIDE: namenode # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable this service: # # namenode_enable (bool): Set to NO by default. # Set it to YES to enable namenode. # namenode_user (str): Set to %%HDFS_USER%% by default. # Set to a valid user to change default # namenode user. # namenode_java_home (str): Unset by default. # Switch to another JVM. # # namenode_log_dir (str): Unset by default. # namenode_pid_dir (str): Unset by default. # . /etc/rc.subr name=namenode rcvar=namenode_enable load_rc_config "${name}" : ${namenode_enable:=NO} : ${namenode_user:=%%HDFS_USER%%} : ${namenode_group:=%%HADOOP_GROUP%%} command="%%DATADIR%%/bin/hadoop-daemon.sh" command_args='--config ${HADOOP_CONF_DIR} start namenode' start_precmd=namenode_init stop_precmd=namenode_init stop_cmd=namenode_stop namenode_init() { if [ -n "${namenode_java_home}" ] then export JAVA_HOME="${namenode_java_home}" fi for f in %%ETCDIR%%/envvars.d/*.env do . ${f} done } namenode_stop () { su -m ${namenode_user} -c "${command} --config ${HADOOP_CONF_DIR} stop namenode" } run_rc_command "$1"