mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-02 01:20:54 +00:00
297b0ffa59
correct permissions. Do not try to do the same every time daemon starts.
61 lines
1.3 KiB
Bash
61 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: datanode
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable this service:
|
|
#
|
|
# datanode_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable datanode.
|
|
# datanode_user (str): Set to %%HDFS_USER%% by default.
|
|
# Set to a valid user to change default
|
|
# datanode user.
|
|
# datanode_java_home (str): Unset by default.
|
|
# Switch to another JVM.
|
|
#
|
|
# datanode_log_dir (str): Unset by default.
|
|
# datanode_pid_dir (str): Unset by default.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=datanode
|
|
rcvar=datanode_enable
|
|
|
|
load_rc_config "${name}"
|
|
|
|
: ${datanode_enable:=NO}
|
|
: ${datanode_user:=%%HDFS_USER%%}
|
|
: ${datanode_group:=%%HADOOP_GROUP%%}
|
|
|
|
command="%%DATADIR%%/bin/hadoop-daemon.sh"
|
|
command_args='--config ${HADOOP_CONF_DIR} start datanode'
|
|
|
|
start_precmd=datanode_init
|
|
stop_precmd=datanode_init
|
|
stop_cmd=datanode_stop
|
|
|
|
|
|
datanode_init()
|
|
{
|
|
if [ -n "${datanode_java_home}" ]
|
|
then
|
|
export JAVA_HOME="${datanode_java_home}"
|
|
fi
|
|
|
|
for f in %%ETCDIR%%/envvars.d/*.env
|
|
do
|
|
. ${f}
|
|
done
|
|
}
|
|
|
|
datanode_stop ()
|
|
{
|
|
su -m ${datanode_user} -c "${command} --config ${HADOOP_CONF_DIR} stop datanode"
|
|
}
|
|
|
|
run_rc_command "$1"
|