#!/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 %%HDFS_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:=%%HDFS_USER%%} : ${secondarynamenode_group:=%%HADOOP_GROUP%%} command="%%DATADIR%%/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 %%ETCDIR%%/envvars.d/*.env do . ${f} done } secondarynamenode_stop () { su -m ${secondarynamenode_user} -c "${command} --config ${HADOOP_CONF_DIR} stop secondarynamenode" } run_rc_command "$1"