From 369b9ee1cfcff7d2178ed0f471fb5a3c0bc2a8bd Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 30 Jul 2001 07:30:11 +0000 Subject: [PATCH] Rework startup script: - We don't want to wait forever until "squid" terminates. Wait at most 20 seconds after a shutdown command use "kill" afterwards. - Don't use "RunCache" to start "squid", it is not necessary and only causes trouble. - Bring the "rotate" command which got lost in last update. Bump package version number to 2.4.1nb2. --- www/squid/Makefile | 4 ++-- www/squid/files/squid.sh | 38 +++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/www/squid/Makefile b/www/squid/Makefile index 03672bc8cae9..8c28427b728b 100644 --- a/www/squid/Makefile +++ b/www/squid/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.48 2001/07/29 16:47:01 tron Exp $ +# $NetBSD: Makefile,v 1.49 2001/07/30 07:30:11 tron Exp $ DISTNAME= squid-2.4.STABLE1-src -PKGNAME= squid-2.4.1nb1 +PKGNAME= squid-2.4.1nb2 CATEGORIES= www MASTER_SITES= http://www.squid-cache.org/Versions/v2/2.4/ \ ftp://ftp.leo.org/pub/comp/general/infosys/www/daemons/squid/squid-2/STABLE/ \ diff --git a/www/squid/files/squid.sh b/www/squid/files/squid.sh index 1e1145d4ec6d..f8d00e6de991 100644 --- a/www/squid/files/squid.sh +++ b/www/squid/files/squid.sh @@ -1,6 +1,6 @@ #! /bin/sh # -# $NetBSD: squid.sh,v 1.9 2001/07/29 16:41:19 tron Exp $ +# $NetBSD: squid.sh,v 1.10 2001/07/30 07:30:12 tron Exp $ # # PROVIDE: squid @@ -14,12 +14,13 @@ conf_file="${SQUID_CONF_DIR}/squid.conf" name="squid" command="@PREFIX@/sbin/${name}" pidfile="/var/run/${name}.pid" -required_files="${conf_file} ${SQUID_CONF_DIR}/squid-mime.conf" +required_files="${conf_file} ${SQUID_CONF_DIR}/mime.conf" +command_args="-Y -f $conf_file" -start_cmd="@PREFIX@/sbin/RunCache ${conf_file} &" stop_cmd="stop_nicely" kill_command="${command} -k shutdown" reload_cmd="${command} -k reconfigure" +rotate_cmd="${command} -k rotate" #### end of configuration section #### @@ -33,12 +34,20 @@ stop_nicely () ${kill_command} if [ ${DAEMON_PID} -ne 0 ]; then echo -n '[' - while kill -0 ${DAEMON_PID} >/dev/null 2>&1; do - sleep 2 - echo -n '.' + for WAIT in 0 1 2 3 4 5 6 7 8 9 + do + if kill -0 ${DAEMON_PID} >/dev/null 2>&1; then + sleep 2 + echo -n '.' + test $WAIT -lt 9 || kill ${DAEMON_PID} + else + break + fi done - echo '] Stopped.' + echo '].' + unset WAIT fi + unset DAEMON_PID fi } @@ -46,14 +55,8 @@ if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then . /etc/rc.subr . /etc/rc.conf - 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 + extra_commands="reload rotate" + load_rc_config $name run_rc_command "$1" else # old NetBSD, Solaris, Linux, etc... @@ -72,6 +75,11 @@ else # old NetBSD, Solaris, Linux, etc... ${reload_cmd} fi ;; + rotate) + if [ -f ${pidfile} ] ; then + ${rotate_cmd} + fi + ;; *) echo "Usage: $0 {start|stop|reload}" 1>&2 exit 64