Hello,
I have a few questions regarding kill_parent_hack (listed
in responses below).
Also, thank you for responding and clarifying "squid -k
shutdown". Enclosed is a revised shutdown script.
Again, many thanks.
On 1 Jan 2002, at 22:13, Henrik Nordstrom wrote:
> On Monday 31 December 2001 19.34, plendon@microelectronics.com wrote:
>
> > Background info: There are 18 remote proxies running on
> > RedHat Linux with 2.2.14-5 kernel. Each of the 18 proxies
> > go to one parent proxy on HP-UX 11.0. All squid versions
> > are 2.4.STABLE4. All squids were compiled with --enable-
> > kill-parent-hack.
>
> Are you sure you want this hack?
Maybe I misunderstand kill-parent-hack. I thought squid
would automatically restart on a shutdown unless kill-
parent-hack was enabled. I need all squids to be shutdown
completely for the nightly processing and then restarted at
6:00am. At 6:15am the squid logs are rotated.
Should I not be using --enable-kill-parent-hack?
>
> Who is the parent of your running squid processes?
root 32073 1 6:00 /usr/local/squid/bin/squid
squid 32075 32073 6:00 (squid)
squid 32081 32075 6:00 (unlinkd)
squid 32142 32075 6:15 (ncsa_auth) /usr/local/squid/etc
squid 32143 32075 6:15 (ncsa_auth) /usr/local/squid/etc
squid 32144 32075 6:15 (ncsa_auth) /usr/local/squid/etc
squid 32145 32075 6:15 (ncsa_auth) /usr/local/squid/etc
squid 32145 32075 6:15 (ncsa_auth) /usr/local/squid/etc
> >From how your start script reads it does not at all look
like you should be
> using --enable-kill-parent-hack.
>
> > What is happening? Squid has shutdown, but has not
> > returned a "Y". Enclosed is the shutdown script.
> > Somewhere in the script is a 30 second wait to ensure squid
> > has shutdown.
>
> Hmm.. your shutdown script seems rather odd. Most likely caused by the
> oddness of "squid -k shutdown".
>
> "squid -k shutdown" only tells Squid to shut down, it does not wait for Squid
> to shut down. It if failed to tell Squid to shut down (most likely not
> running, or the pid file has been trashed) then it will return false, else
> true.
>
> To make a foolproof Squid "shutdown" you need to
>
> squid -k shutdown
>
> if successful, wait for a while. suggested up to 2 minutes or until the last
> Squid process disappears.
>
> if Squid processes remains
> log a warning
> kill -TERM any remaining squid processes
> wait again
> kill -KILL any remaining squid processes just to make sure..
> endif
>
> Regards
> Henrik
>
>
> --
> MARA Systems AB, Giving you basic free Squid support
> Customized solutions, packaged solutions and priority support
> available on request
>
#!/bin/sh
#
# Starts and stops squid proxy/cache server .
#
# See how we were called.
PIDLOG=/usr/local/squid/logs/pid.log
PIDFILE=/usr/local/squid/logs/squid.pid
SQUID_TIMEOUT=300
case "$1" in
start_msg)
echo "Starting squid server"
;;
stop_msg)
echo "Stopping squid server"
;;
start)
echo "Starting squid server"
/usr/local/squid/bin/squid
;;
stop)
# Log some info
echo "`date`" > $PIDLOG
echo "Squid processes are:" >> $PIDLOG
ps -ef|grep squid|awk '{print $0}' >> $PIDLOG
echo "netstat listing:" >> $PIDLOG
netstat -a |grep 3128 >> $PIDLOG
echo "lsof listing:" >> $PIDLOG
/usr/sbin/lsof -i :3128|awk '{print $0}' >> $PIDLOG
echo "Checking to see if squid is running..." >> $PIDLOG
/usr/local/squid/bin/squid -k check >/dev/null 2>&1
RETVAL=$?
echo $RETVAL >> $PIDLOG
if [ $RETVAL -eq 0 ] ; then
echo "Stopping squid server" >> $PIDLOG
/usr/local/squid/bin/squid -k shutdown
RETVAL=$?
echo $RETVAL >> $PIDLOG
if [ $RETVAL -ne 0 ] ; then
echo "Unable to shutdown squid" >> $PIDLOG
exit 1
else
echo "Now sleeping for five minutes to give squid some time to shutdown..." >> $PIDLOG
sleep $SQUID_TIMEOUT
fi
else
echo "Squid already not running, or other problem?" >> $PIDLOG
exit 0
fi
echo "Checking to see if squid is still running." >> $PIDLOG
/usr/local/squid/bin/squid -k check >/dev/null 2>&1
RETVAL=$?
echo $RETVAL >> $PIDLOG
if [ $RETVAL -eq 0 ] ; then
echo "Squid is still running..." >> $PIDLOG
SQUID_PIDS=`ps -ef|grep squid|awk '{if ($8 != "grep" && $9 != "squid" && $10 != "stop") print $2}'`
echo "What are the remaining processes?" >> $PIDLOG
echo $SQUID_PIDS >> $PIDLOG
echo "Going to kill remaining processes" >> $PIDLOG
2>&- kill -15 $SQUID_PIDS
sleep 100
else
echo "Squid is not running" >> $PIDLOG
exit 0
fi
echo "Checking again to see if squid is still running." >> $PIDLOG
/usr/local/squid/bin/squid -k check >/dev/null 2>&1
RETVAL=$?
echo $RETVAL >> $PIDLOG
if [ $RETVAL -eq 0 ] ; then
echo "Squid is still running ... " >> $PIDLOG
exit 1
else
echo "Squid is not running" >> $PIDLOG
exit 0
fi
;;
restart)
echo "Re-read squid conf file"
/usr/local/squid/bin/squid -k reconfigure
;;
*)
echo "Usage: /sbin/init.d/squid {start|stop|restart}"
exit 1
esac
exit
Received on Thu Jan 03 2002 - 11:58:22 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:05:37 MST