diff options
author | tron <tron> | 2001-07-29 16:41:18 +0000 |
---|---|---|
committer | tron <tron> | 2001-07-29 16:41:18 +0000 |
commit | 276cea0b05bf9868ff98fa23c9313170a19ddd0f (patch) | |
tree | f4a7d424b88e5ae4ebeb2523719c6e2164752c6a /www/squid/files | |
parent | b6e5c5f88370450ca7f4acf0fa04cacd4bcfcef6 (diff) | |
download | pkgsrc-276cea0b05bf9868ff98fa23c9313170a19ddd0f.tar.gz |
- Apply some of the changes suggested by Greg A. Woods in PR 13427 and
include his improved "rc.d" script.
- Use the same directory structure as in the Apache package. The
configuration files are now in "${PREFIX}/etc/squid" and won't be
removed during deinstallation.
- Remove unnecessary configuration variables "SQUID_HTTP_PORT" and
"SQUID_ICP_PORT". These values can perfectly be adjusted by editing
the configuration file and supporting all these variables would make
the package too complex.
- Bump the version number to 2.4.1nb1.
Diffstat (limited to 'www/squid/files')
-rw-r--r-- | www/squid/files/squid.sh | 85 |
1 files changed, 68 insertions, 17 deletions
diff --git a/www/squid/files/squid.sh b/www/squid/files/squid.sh index 12484055b7c..1e1145d4ec6 100644 --- a/www/squid/files/squid.sh +++ b/www/squid/files/squid.sh @@ -1,30 +1,81 @@ -#!/bin/sh +#! /bin/sh # -# $NetBSD: squid.sh,v 1.8 2001/05/10 21:58:02 tron Exp $ +# $NetBSD: squid.sh,v 1.9 2001/07/29 16:41:19 tron Exp $ # + # PROVIDE: squid # REQUIRE: DAEMON # KEYWORD: shutdown +SQUID_CONF_DIR="@PREFIX@/etc/squid" + +conf_file="${SQUID_CONF_DIR}/squid.conf" + name="squid" command="@PREFIX@/sbin/${name}" -required_files="/etc/squid.conf" -command_args="-Y -f $required_files" +pidfile="/var/run/${name}.pid" +required_files="${conf_file} ${SQUID_CONF_DIR}/squid-mime.conf" -if [ ! -d /etc/rc.d ] -then - @ECHO@ -n ' ${name}' - exec ${command} ${command_args} -fi +start_cmd="@PREFIX@/sbin/RunCache ${conf_file} &" +stop_cmd="stop_nicely" +kill_command="${command} -k shutdown" +reload_cmd="${command} -k reconfigure" -. /etc/rc.subr +#### end of configuration section #### -extra_commands="reload" +# XXX Shouldn't the default stop_cmd be this patient too? +# +stop_nicely () +{ + if [ -f ${pidfile} ] ; then + DAEMON_PID=`sed 1q ${pidfile}` + echo -n "Stopping ${name}" + ${kill_command} + if [ ${DAEMON_PID} -ne 0 ]; then + echo -n '[' + while kill -0 ${DAEMON_PID} >/dev/null 2>&1; do + sleep 2 + echo -n '.' + done + echo '] Stopped.' + fi + fi +} -if [ "$1" = rotate ] -then - exec ${command} -k rotate -fi +if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then + . /etc/rc.subr + . /etc/rc.conf -load_rc_config $name -run_rc_command "$1" + start_precmd="checkyesno squid" + stop_precmd=${start_precmd} + reload_precmd=${start_precmd} + extra_commands="reload" + + if type load_rc_config > /dev/null 2>&1 ; then + load_rc_config $name + fi + run_rc_command "$1" + +else # old NetBSD, Solaris, Linux, etc... + + case $1 in + start) + if [ -x ${command} -a -f ${conf_file} ] ; then + eval ${start_cmd} && echo -n " ${name}" + fi + ;; + stop) + ${stop_cmd} + ;; + reload) + if [ -f ${pidfile} ] ; then + ${reload_cmd} + fi + ;; + *) + echo "Usage: $0 {start|stop|reload}" 1>&2 + exit 64 + ;; + esac + +fi |