2000-07-05 14:37:06 +02:00
|
|
|
#!/bin/sh
|
2004-01-16 22:18:20 +01:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# PROVIDE: squid
|
2005-12-26 00:38:48 +01:00
|
|
|
# REQUIRE: LOGIN
|
|
|
|
# KEYWORD: shutdown
|
2007-02-07 09:42:31 +01:00
|
|
|
#
|
2004-01-16 22:18:20 +01:00
|
|
|
# Note:
|
2004-09-02 08:44:14 +02:00
|
|
|
# Set "squid_enable=yes" in either /etc/rc.conf, /etc/rc.conf.local or
|
2004-01-16 22:18:20 +01:00
|
|
|
# /etc/rc.conf.d/squid to make this script actually do something. There
|
2007-08-14 04:32:11 +02:00
|
|
|
# you can also set squid_chdir, squid_pidfile, squid_user, and squid_flags.
|
2004-01-16 22:18:20 +01:00
|
|
|
#
|
|
|
|
# Please see squid(8), rc.conf(5) and rc(8) for further details.
|
2004-09-02 08:44:14 +02:00
|
|
|
#
|
2006-07-09 17:20:10 +02:00
|
|
|
|
2007-03-07 23:47:15 +01:00
|
|
|
squid_checkrunning() {
|
|
|
|
${command} ${squid_flags} -k check 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2006-07-09 17:20:10 +02:00
|
|
|
squid_stop() {
|
2006-07-10 21:57:12 +02:00
|
|
|
echo "Stopping ${name}."
|
2006-11-05 00:18:03 +01:00
|
|
|
${command} ${squid_flags} -k shutdown
|
2006-07-09 17:20:10 +02:00
|
|
|
run_rc_command poll
|
|
|
|
}
|
|
|
|
|
|
|
|
. %%RC_SUBR%%
|
2000-07-05 14:37:06 +02:00
|
|
|
|
2004-09-02 08:44:14 +02:00
|
|
|
name=squid
|
2006-07-09 17:20:10 +02:00
|
|
|
rcvar=${name}_enable
|
|
|
|
|
2004-01-16 22:18:20 +01:00
|
|
|
command=%%PREFIX%%/sbin/squid
|
|
|
|
extra_commands=reload
|
2006-11-05 00:18:03 +01:00
|
|
|
reload_cmd="${command} ${squid_flags} -k reconfigure"
|
2007-03-07 23:47:15 +01:00
|
|
|
stop_precmd="squid_checkrunning"
|
2004-10-13 11:43:48 +02:00
|
|
|
stop_cmd="squid_stop"
|
2006-07-09 17:20:10 +02:00
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
|
2007-08-14 04:32:11 +02:00
|
|
|
squid_chdir=${squid_chdir:-"%%PREFIX%%/squid/logs"}
|
2004-07-25 18:30:43 +02:00
|
|
|
squid_enable=${squid_enable:-"NO"}
|
2004-07-28 04:10:54 +02:00
|
|
|
squid_flags=${squid_flags-"-D"}
|
2007-08-14 04:32:11 +02:00
|
|
|
squid_pidfile=${squid_pidfile:-"%%PREFIX%%/squid/logs/squid.pid"}
|
2004-07-25 18:30:43 +02:00
|
|
|
squid_user=${squid_user:-%%SQUID_UID%%}
|
2004-01-16 22:18:20 +01:00
|
|
|
default_config=%%PREFIX%%/etc/squid/squid.conf
|
2000-07-05 14:37:06 +02:00
|
|
|
|
2007-08-14 04:32:11 +02:00
|
|
|
pidfile=${squid_pidfile}
|
2006-07-09 17:20:10 +02:00
|
|
|
required_dirs=${squid_chdir}
|
2004-09-02 08:44:14 +02:00
|
|
|
|
|
|
|
# squid(8) will not start if ${default_config} is not present so try
|
|
|
|
# to catch that beforehand via ${required_files} rather than make
|
|
|
|
# squid(8) crash.
|
|
|
|
# If you remove the default configuration file make sure to add
|
|
|
|
# '-f /path/to/your/squid.conf' to squid_flags
|
|
|
|
|
|
|
|
if [ -z "${squid_flags}" ]; then
|
|
|
|
required_files=${default_config}
|
2004-01-16 22:18:20 +01:00
|
|
|
fi
|
2006-07-09 17:20:10 +02:00
|
|
|
|
2004-09-02 08:44:14 +02:00
|
|
|
run_rc_command "$1"
|