summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2013-08-06 15:44:34 +0000
committeradam <adam@pkgsrc.org>2013-08-06 15:44:34 +0000
commitaf4f304b3bcdb9a54be5f0112ed06694d21bf4bf (patch)
treee1de56bc7fc849f7bc4eddc762d0a954cdc78991
parentf98628f88cd9b00e3ef7a33f62cfb3e79bd1981b (diff)
downloadpkgsrc-af4f304b3bcdb9a54be5f0112ed06694d21bf4bf.tar.gz
Don't wait 30 seconds to stop the daemon.
-rw-r--r--www/squid/files/squid.sh46
1 files changed, 8 insertions, 38 deletions
diff --git a/www/squid/files/squid.sh b/www/squid/files/squid.sh
index b0fc69beea0..295bcae6693 100644
--- a/www/squid/files/squid.sh
+++ b/www/squid/files/squid.sh
@@ -1,8 +1,7 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: squid.sh,v 1.21 2008/03/11 15:46:41 taca Exp $
+# $NetBSD: squid.sh,v 1.22 2013/08/06 15:44:34 adam Exp $
#
-
# PROVIDE: squid
# REQUIRE: DAEMON
# KEYWORD: shutdown
@@ -20,46 +19,17 @@ pidfile="@VARBASE@/run/${name}.pid"
required_files="${squid_conf} @PKG_SYSCONFDIR@/mime.conf"
command_args="-Y -f ${squid_conf}"
-stop_cmd="stop_nicely"
-kill_command="${command} ${squid_flags} ${command_args} -k shutdown"
+# Note: 'shutdown' waits 30 seconds, while 'interrupt' stops immediately
+stop_cmd="${command} ${squid_flags} ${command_args} -k interrupt"
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"
-#### end of configuration section ####
-
-# 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 '['
- for WAIT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- do
- if kill -0 ${DAEMON_PID} >/dev/null 2>&1; then
- sleep 4
- @ECHO@ -n '.'
- test $WAIT -lt 15 || kill ${DAEMON_PID}
- else
- break
- fi
- done
- @ECHO@ '].'
- unset WAIT
- fi
- unset DAEMON_PID
- fi
-}
-
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 # old NetBSD, Solaris, Linux, etc...
+else
if [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
@@ -67,7 +37,7 @@ else # old NetBSD, Solaris, Linux, etc...
start)
start_cmd="${command} ${squid_flags} ${command_args}"
if [ -x ${command} -a -f ${squid_conf} ] ; then
- eval ${start_cmd} && @ECHO@ -n " ${name}"
+ ${start_cmd}
fi
;;
stop)
@@ -77,17 +47,17 @@ else # old NetBSD, Solaris, Linux, etc...
${createdirs_cmd}
;;
reload)
- if [ -f ${pidfile} ] ; then
+ if [ -r "${pidfile}" ] ; then
${reload_cmd}
fi
;;
rotate)
- if [ -f ${pidfile} ] ; then
+ if [ -r "${pidfile}" ] ; then
${rotate_cmd}
fi
;;
*)
- @ECHO@ "Usage: $0 {start|stop|reload|createdirs}" 1>&2
+ @ECHO@ "Usage: $0 {start|stop|reload|rotate|createdirs}" 1>&2
exit 64
;;
esac