2016-01-21 23:40:00 +01:00

66 lines
1.4 KiB
Bash

#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: squid.sh,v 1.2 2014/08/29 11:13:46 tron Exp $
#
# PROVIDE: squid
# REQUIRE: DAEMON
# KEYWORD: shutdown
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
: ${squid_conf:=@PKG_SYSCONFDIR@/squid.conf}
name="squid"
rcvar=$name
command="@PREFIX@/sbin/${name}"
pidfile="@VARBASE@/run/${name}.pid"
procname="squid-1"
required_files="${squid_conf} @PKG_SYSCONFDIR@/mime.conf"
command_args="-Y -f ${squid_conf}"
start_precmd='ulimit -n 4096'
# Note: 'shutdown' waits 30 seconds, while 'interrupt' stops immediately
reload_cmd="${command} ${squid_flags} ${command_args} -k reconfigure"
rotate_cmd="${command} ${squid_flags} ${command_args} -k rotate"
createdirs_cmd="${command} ${squid_flags} ${command_args} -z"
extra_commands="createdirs reload rotate"
if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -f /etc/rc.d/DAEMON ]; then
load_rc_config $name
run_rc_command "$1"
else
if [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
case $1 in
start)
start_cmd="${command} ${squid_flags} ${command_args}"
if [ -x ${command} -a -f ${squid_conf} ] ; then
${start_cmd}
fi
;;
stop)
${stop_cmd}
;;
createdirs)
${createdirs_cmd}
;;
reload)
if [ -r "${pidfile}" ] ; then
${reload_cmd}
fi
;;
rotate)
if [ -r "${pidfile}" ] ; then
${rotate_cmd}
fi
;;
*)
@ECHO@ "Usage: $0 {start|stop|reload|rotate|createdirs}" 1>&2
exit 64
;;
esac
fi