blob: 7d30f4e531f58ee0f746783824272d1d63be6f1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh
# 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"
|