Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 2004 22:39:00 -0800 (PST)
From:      "Freddie Cash" <fcash-ml@sd73.bc.ca>
To:        ports@freebsd.org
Subject:   Re: OPTIONS, LATEST_LINK, and RCng
Message-ID:  <50589.24.71.131.139.1077518340.squirrel@mailtest.sd73.bc.ca>
In-Reply-To: <2107.24.71.130.94.1077515696.squirrel@mailtest.sd73.bc.ca>
References:  <2107.24.71.130.94.1077515696.squirrel@mailtest.sd73.bc.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
I've butchered the squid.sh script into the following.  The resulting
script appears to work and relies on an entry in /etc/rc.conf like the
rest do.  I've tested the various targets for the script and they seem
to be doing the right thing.

Would someone mind having a look to see if everything is kosher?  Thanks.

One quick question:  Should "squid" be added to the REQUIRE line, or
is that only for system services?

*** Begin dansguardian.sh ***
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dansguardian
# REQUIRE: NETWORKING SERVERS
# AFTER: squid
# KEYWORD: FreeBSD
#
# Note:
# If you are running an rcNG-System (i.e. FreeBSD 5 and later or after
# having installed the rc_subr-port on an earlier system) you must set
# "dansguardian_enable=YES" in either /etc/rc.conf, /etc/rc.conf.local
# or /etc/rc.conf.d/dansguardian to make this script actually do
# something.
#
# Please see dansguardian(8), rc.conf(5) and rc(8) for further details.

unset rcNG
name="dansguardian"
command="/usr/local/sbin/dansguardian"
extra_commands="restart graceful"
restart_cmd="${command} -r"
graceful_cmd="${command} -g"
stop_cmd="${command} -q"

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr && rcNG="yes"
else
	if [ -f /usr/local/etc/rc.subr ]; then
		. /usr/local/etc/rc.subr && rcNG="yes"
	fi
fi

if [ "${rcNG}" ]; then
	rcvar=`set_rcvar`
	load_rc_config ${name}
	run_rc_command "$1"
else
	case "$1" in
	start)
		if [ -x "${command}" ]; then
			echo -n ' dansguardian'
			${command}
		fi
		;;
	stop)
		if [ -x "${command}" ]; then
			echo -n ' squid'
			${stop_cmd}
		fi
		;;
	restart)
		if [ -x "${command}" ]; then
			echo -n ' dansguardian'
			${restart_cmd}
		fi
		;;
	graceful)
		if [ -x "${command}" ]; then
			echo -n ' dansguardian'
			${graceful_cmd}
		fi
		;;
	*)
		echo "Usage: `basename $0` {start|stop|restart|graceful}" >&2
		exit 64
		;;
	esac
	exit 0
fi

*** End dansguardian.sh ***


--
Freddie Cash
fcash-ml@sd73.bc.ca



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50589.24.71.131.139.1077518340.squirrel>