summaryrefslogtreecommitdiff
path: root/devel/zookeeper/files/zookeeper.in
blob: 81f8f03148c2cea6a73995abcc09de08ebf6a7fa (plain) (blame)
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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: zookeeper
# REQUIRE: LOGIN
# 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

# set defaults
: ${zookeeper_enable:="NO"}
: ${zookeeper_logdir="%%ZOOKEEPER_LOGDIR%%"}
: ${zookeeper_rundir="%%ZOOKEEPER_RUNDIR%%"}
: ${zookeeper_jmx:="YES"}

command="%%PREFIX%%/zookeeper/bin/zkServer.sh"

start_cmd="zookeeper_command start"
stop_cmd="zookeeper_command stop"
restart_cmd="zookeeper_command restart"
status_cmd="zookeeper_command status"

export ZOO_LOG_DIR=${zookeeper_logdir}
export ZOOPIDFILE=${zookeeper_rundir}/zookeeper.pid

zookeeper_command()
{
	export JAVA_HOME=%%JAVA_HOME%%
	if ! checkyesno zookeeper_jmx; then
		export JMXDISABLE=yes
	fi
	${command} ${rc_arg}
}

run_rc_command "$1"