#!/bin/sh # # $FreeBSD: head/devel/hadoop2/files/datanode.in 414111 2016-04-27 14:52:41Z demon $ # # PROVIDE: datanode # REQUIRE: LOGIN # KEYWORD: shutdown # # datanode_enable (bool): Set to NO by default. # Set it to YES to enable datanode. . /etc/rc.subr export PATH=${PATH}:%%LOCALBASE%%/bin name=datanode rcvar=datanode_enable pidfile=%%HADOOP_RUNDIR%%/hadoop-%%HDFS_USER%%-${name}.pid load_rc_config "${name}" : ${datanode_enable:=NO} : ${datanode_user:=%%HDFS_USER%%} command="%%PREFIX%%/sbin/hadoop-daemon.sh" command_interpreter_execution="%%JAVA_HOME%%/bin/java" command_args='--config %%ETCDIR%% start datanode' start_postcmd="start_postcmd" stop_cmd=datanode_stop status_precmd=find_pid start_postcmd () { rc_pid=$(check_pidfile ${pidfile} %%JAVA_HOME%%/bin/java) if [ -n "$rc_pid" ]; then protect -p $rc_pid fi } datanode_stop () { su -m ${datanode_user} -c "${command} --config %%ETCDIR%% stop datanode" } find_pid () { rc_pid=$(check_pidfile $pidfile $command_interpreter_execution) } run_rc_command "$1"