#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: c-icap
# REQUIRE: DAEMON cleanvar
# BEFORE: LOGIN

#
# Add the following lines to /etc/rc.conf to enable c-icap:
#
# c_icap_enable="YES"
# c_icap_flags="<set as needed>"
#
# See '/usr/local/bin/c-icap --help' for flags
#

. /etc/rc.subr

name=c_icap
rcvar=c_icap_enable

command="/usr/local/bin/c-icap"

stop_postcmd="rm -f $pidfile"

# read settings, set default values
load_rc_config "$name"
: ${c_icap_enable="NO"}
: ${c_icap_conf="/usr/local/etc/c-icap/c-icap.conf"}
: ${c_icap_pidfile="/var/run/c-icap/c-icap.pid"}
: ${c_icap_user="c_icap"}

pidfile="${c_icap_pidfile}"
required_files="${c_icap_conf}"
command_args="-f ${c_icap_conf}"
stop_postcmd=stop_postcmd

stop_postcmd() {
	rm -f /var/run/c-icap/c-icap.ctl
}

run_rc_command "$1"
