freebsd-ports/devel/hadoop2/files/nodemanager.in
Dmitry Sivachenko cc6b239238 Fix 'status' argument for rc-scripts.
PR:		208639
Submitted by:	xmj
2016-04-27 14:52:41 +00:00

47 lines
1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nodemanager
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# nodemanager_enable (bool): Set to NO by default.
# Set it to YES to enable resourcemanager.
. /etc/rc.subr
export PATH=${PATH}:%%LOCALBASE%%/bin
name=nodemanager
rcvar=nodemanager_enable
pidfile=%%HADOOP_RUNDIR%%/yarn-yarn-${name}.pid
load_rc_config "${name}"
: ${nodemanager_enable:=NO}
: ${nodemanager_user:=%%MAPRED_USER%%}
command="%%PREFIX%%/sbin/yarn-daemon.sh"
command_interpreter_execution="%%JAVA_HOME%%/bin/java"
command_args='--config %%ETCDIR%% start nodemanager'
start_postcmd="start_postcmd"
stop_cmd=nodemanager_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
}
nodemanager_stop () {
su -m ${nodemanager_user} -c "${command} --config %%ETCDIR%% stop nodemanager"
}
find_pid () {
rc_pid=$(check_pidfile $pidfile $command_interpreter_execution)
}
run_rc_command "$1"