blob: 6475558955b7261a5ac8ddd496fb1108682c6e9a (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh
# PROVIDE: zookeeper
# REQUIRE: NETWORKING SERVERS DAEMON
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable zookeeper:
#
# zookeeper_enable="YES"
. /etc/rc.subr
name=zookeeper
rcvar=zookeeper_enable
load_rc_config "${name}"
: ${zookeeper_enable:="NO"}
: ${zookeeper_user:="%%ZOOKEEPER_USER%%"}
: ${zookeeper_group:="%%ZOOKEEPER_GROUP%%"}
: ${zookeeper_config:="%%ETCDIR%%/zoo.cfg"}
: ${zookeeper_log4j_config:="%%ETCDIR%%/log4j.properties"}
: ${zookeeper_rootlogger:="INFO,ROLLINGFILE"}
: ${zookeeper_logdir:="%%ZOOKEEPER_LOGDIR%%"}
: ${zookeeper_syslog_output_enable:="YES"}
start_precmd="zookeeper_start_precmd"
# backwards compatibility
if [ -n "${zookeeper_jvmopts}" ]; then
zookeeper_java_opts=${zookeeper_jvmopts}
fi
if [ -n "${zookeeper_log4jpropfile}" ]; then
zookeeper_log4j_config="${zookeeper_log4jpropfile#file:}"
fi
if checkyesno zookeeper_syslog_output_enable; then
if [ -n "${zookeeper_syslog_output_tag}" ]; then
zookeeper_syslog_output_flags="-T ${zookeeper_syslog_output_tag}"
else
zookeeper_syslog_output_flags="-T ${name}"
fi
if [ -n "${zookeeper_syslog_output_priority}" ]; then
zookeeper_syslog_output_flags="${zookeeper_syslog_output_flags} -s ${zookeeper_syslog_output_priority}"
fi
if [ -n "${zookeeper_syslog_output_facility}" ]; then
zookeeper_syslog_output_flags="${zookeeper_syslog_output_flags} -l ${zookeeper_syslog_output_facility}"
fi
fi
JAVA="%%JAVA%%"
CLASSPATH=":%%DATADIR%%/*"
log4j_params="-Dzookeeper.root.logger=${zookeeper_rootlogger} -Dzookeeper.log.dir=${zookeeper_logdir} -Dlog4j.configuration=file:${zookeeper_log4j_config}"
zookeeper_main="${zookeeper_java_opts} ${log4j_params} -cp ${CLASSPATH} org.apache.zookeeper.server.quorum.QuorumPeerMain ${zookeeper_config}"
pidfile="/var/run/${name}.pid"
required_dirs="${zookeeper_logdir}"
required_files="${zookeeper_config} ${zookeeper_log4j_config}"
command="/usr/sbin/daemon"
command_args="-f ${zookeeper_syslog_output_flags} -P ${pidfile} -t ${name} ${JAVA} ${zookeeper_main}"
zookeeper_start_precmd()
{
if [ ! -e "${pidfile}" ]; then
install -m 0600 -o "${zookeeper_user}" -g "${zookeeper_group}" /dev/null "${pidfile}"
fi
}
run_rc_command "$1"
|