#!/bin/sh

# $FreeBSD$
#
# PROVIDE: builder_web
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Define these builder_web_* variables in one of these files
# 	 /etc/rc.conf
#	 /etc/rc.conf.local
#	 /etc/rc.conf.d/builder_web
#	 /usr/local/etc/rc.conf.d/builder_web
#
# builder_web_flags:
#                       Default: ""
#

. /etc/rc.subr

name=builder_web
rcvar=${name}_enable
desc="Builder web service"
load_rc_config $name
start_cmd="builder_web_start"

: ${builder_web_enable:="NO"}
: ${builder_web_flags:=""}
: ${builder_web_user:="builder"}

pidfile="/var/run/builder_web.pid"
procname="/usr/local/libexec/builder-web"

builder_web_start () {
    echo "Starting ${name}."
    /usr/sbin/daemon -S -r -P "${pidfile}" -u "${builder_web_user}" \
		     "${procname}" ${builder_web_flags}
}

run_rc_command "$1"