Lines 1-55
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
2 |
# |
2 |
# |
3 |
# $FreeBSD$ |
3 |
# $FreeBSD$ |
4 |
# |
4 |
# |
5 |
|
5 |
|
6 |
# PROVIDE: kibana |
6 |
# PROVIDE: kibana |
7 |
# REQUIRE: DAEMON |
7 |
# REQUIRE: DAEMON |
8 |
# KEYWORD: shutdown |
8 |
# KEYWORD: shutdown |
9 |
|
9 |
|
10 |
. /etc/rc.subr |
10 |
. /etc/rc.subr |
11 |
|
11 |
|
12 |
name=kibana |
12 |
name=kibana |
13 |
rcvar=kibana_enable |
13 |
rcvar=kibana_enable |
14 |
|
14 |
|
15 |
load_rc_config $name |
15 |
load_rc_config $name |
16 |
|
16 |
|
17 |
: ${kibana_enable:="NO"} |
17 |
: ${kibana_enable:="NO"} |
18 |
: ${kibana_config:="%%ETCDIR%%/kibana.yml"} |
18 |
: ${kibana_config:="%%ETCDIR%%/kibana.yml"} |
19 |
: ${kibana_user:="www"} |
19 |
: ${kibana_user:="www"} |
20 |
: ${kibana_group:="www"} |
20 |
: ${kibana_group:="www"} |
21 |
: ${kibana_log:="/var/log/kibana.log"} |
21 |
: ${kibana_log:="/var/log/kibana.log"} |
22 |
|
22 |
|
23 |
export BABEL_DISABLE_CACHE=1 |
23 |
export BABEL_DISABLE_CACHE=1 |
24 |
export NODE_ENV=production |
24 |
export NODE_ENV=production |
25 |
# ml and reporting modules not supported on FreeBSD |
25 |
# ml and reporting modules not supported on FreeBSD |
26 |
export XPACK_ML_ENABLED=false |
26 |
export XPACK_ML_ENABLED=false |
27 |
export XPACK_REPORTING_ENABLED=false |
27 |
export XPACK_REPORTING_ENABLED=false |
28 |
|
28 |
|
29 |
required_files="${kibana_config}" |
29 |
required_files="${kibana_config}" |
30 |
pidfile="/var/run/${name}/${name}.pid" |
30 |
pidfile="/var/run/${name}/${name}.pid" |
31 |
start_precmd="kibana_precmd" |
31 |
start_precmd="kibana_precmd" |
32 |
procname="%%LOCALBASE%%/bin/node" |
32 |
procname="%%LOCALBASE%%/bin/node" |
33 |
command="/usr/sbin/daemon" |
33 |
command="/usr/sbin/daemon" |
34 |
command_args="-f -p ${pidfile} ${procname} --no-warnings %%WWWDIR%%/src/cli serve --config ${kibana_config} --log-file ${kibana_log}" |
34 |
command_args="-f -p ${pidfile} ${procname} --no-warnings %%WWWDIR%%/src/cli/dist serve --config ${kibana_config} --log-file ${kibana_log}" |
35 |
|
35 |
|
36 |
kibana_precmd() |
36 |
kibana_precmd() |
37 |
{ |
37 |
{ |
38 |
if [ ! -d $(dirname ${pidfile}) ]; then |
38 |
if [ ! -d $(dirname ${pidfile}) ]; then |
39 |
install -d -o ${kibana_user} -g ${kibana_group} $(dirname ${pidfile}) |
39 |
install -d -o ${kibana_user} -g ${kibana_group} $(dirname ${pidfile}) |
40 |
fi |
40 |
fi |
41 |
|
41 |
|
42 |
if [ ! -f ${kibana_log} ]; then |
42 |
if [ ! -f ${kibana_log} ]; then |
43 |
install -o ${kibana_user} -g ${kibana_group} -m 640 /dev/null ${kibana_log} |
43 |
install -o ${kibana_user} -g ${kibana_group} -m 640 /dev/null ${kibana_log} |
44 |
fi |
44 |
fi |
45 |
|
45 |
|
46 |
if [ ! -d %%WWWDIR%%/optimize ]; then |
46 |
if [ ! -d %%WWWDIR%%/optimize ]; then |
47 |
install -d -o ${kibana_user} -g ${kibana_group} %%WWWDIR%%/optimize |
47 |
install -d -o ${kibana_user} -g ${kibana_group} %%WWWDIR%%/optimize |
48 |
else |
48 |
else |
49 |
# We may have installed a plugin as root which will cause files in here |
49 |
# We may have installed a plugin as root which will cause files in here |
50 |
# to be owned by root:wheel. Fix with a chown. |
50 |
# to be owned by root:wheel. Fix with a chown. |
51 |
chown -R ${kibana_user}:${kibana_group} %%WWWDIR%%/optimize |
51 |
chown -R ${kibana_user}:${kibana_group} %%WWWDIR%%/optimize |
52 |
fi |
52 |
fi |
53 |
} |
53 |
} |
54 |
|
54 |
|
55 |
run_rc_command "$1" |
55 |
run_rc_command "$1" |