OPTIONS, LATEST_LINK, and RCng
Freddie Cash
fcash-ml at sd73.bc.ca
Sun Feb 22 22:39:00 PST 2004
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 at sd73.bc.ca
More information about the freebsd-ports
mailing list