#!/bin/sh # # $FreeBSD: head/textproc/kibana41/files/kibana.in 393628 2015-08-06 01:22:34Z junovitch $ # # PROVIDE: kibana # REQUIRE: DAEMON # KEYWORD: shutdown . /etc/rc.subr name=kibana rcvar=kibana_enable load_rc_config $name : ${kibana_enable:="NO"} : ${kibana_config:="%%PREFIX%%/etc/kibana.yml"} : ${kibana_user:="www"} : ${kibana_group:="www"} : ${kibana_log:="/var/log/kibana.log"} required_files="${kibana_config}" pidfile="/var/run/${name}/${name}.pid" start_precmd="kibana_precmd" procname="%%LOCALBASE%%/bin/node" command="/usr/sbin/daemon" command_args="-p ${pidfile} env NODE_ENV='production' ${procname} %%WWWDIR%%/bin/kibana.js ${kibana_flags} --config ${kibana_config} >> ${kibana_log} 2>&1" kibana_precmd() { if [ ! -d $(dirname ${pidfile}) ]; then mkdir $(dirname ${pidfile}) chown ${kibana_user}:${kibana_group} $(dirname ${pidfile}) fi if [ ! -f ${kibana_log} ]; then install -o ${kibana_user} -g ${kibana_group} -m 640 /dev/null ${kibana_log} fi rc_flags="" } run_rc_command "$1"