#!/bin/sh

# $FreeBSD$
#
# PROVIDE: hawk
# REQUIRE: LOGIN mysql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# hawk_enable (bool):	Set to NO by default.
#			Set it to YES to enable hawk.

. /etc/rc.subr

name=hawk
rcvar=hawk_enable

load_rc_config hawk

: ${hawk_enable:="NO"}

command=/usr/local/sbin/hawk
command_interpreter=/usr/local/bin/perl
command_args='&'
start_precmd=find_pidfile
stop_precmd=find_pidfile

find_pidfile()
{
	if get_pidfile_from_conf pidfile /usr/local/etc/hawk/daemon.conf; then
		pidfile="$_pidfile_from_conf"
	else
		pidfile='/var/run/hawk.pid'
	fi
}

run_rc_command "$1"
