Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The squid (2.7) proxy that I have running on ubuntu 8.10 stops accepting new requests after being online for a while, due to reasons that I can't discover. However doing a squid -k reconfigure resolves the problem immediately.

Now I manually run this command by monitoring the log and if i don't see any activity for 5 minutes I reload the config.

Now on my quest for a solution I had several ideas:

  1. diagnose the root cause and eliminate it
  2. setup a script to automatically reload script if no new entries in access.log for the past 3 minutes
  3. painstakingly upgrade server to newer ubuntu version while keeping network offline or during off hours to minimize downtime.

I turn to you for solutions to option 2), as I do not understand squid enough for 1), and I'm avoiding 3) as long as i can. Any ideas?

share|improve this question
When the problem occurs are there any related messages in the sqiud logs in /var/log/squid ? – Iain Jan 31 '11 at 12:11
I have checked the logs but I don't find anything strange in cache.log or access.log, squid says that it's still waiting for requests... that's why I gave up on option 1) – Vijay Feb 1 '11 at 4:07
> ubuntu 8.10 ? The first thing I'd suggest is update. (But this might be not in corellation.) > The squid (2.7) 2.7.what? Have tried 3.1? (Again, not 100 % corellated) > accepting new requests after being online for a while What do you mean "being online for a while"? How the cycle does exactly look like (power_on, squid_works_ok, squid_fails, squid_restart)? – poige Feb 1 '11 at 11:09
yes exactly what you said. – Vijay Feb 1 '11 at 11:09
ok, squid restarted, then what? – poige Feb 1 '11 at 11:09
up vote 1 down vote accepted

I've come across a similar behaviour in squid (this was about 5 years ago - never got to the bottom of it) but in my case it would start slowing down after being up for 2-3 days.

Something like this run from cron should give the required behaviour for it locking up completely (assuming it stops writing to the log files):


 # you may need to change the above to point to your logfile
 # above can be whatever - but dir must exist

 if [ ! -f ${LASTRUN} ] ; then
      touch ${LASTRUN}
 if [ ${LASTRUN} -nt ${LOGFILE} ] ; then
       /usr/sbin/squid -k reload
 touch ${LASTRUN}

This needs to run as root - so either in the root crontab, or the system crontab...

 */5 * * * * /path/to/shellscript

(note you should not edit the crontab file in place - use crontab -l >copy_ctb to get a copy of the current crontab, edit it, then load the new config using crontab copy_ctb)

share|improve this answer
Ok I am using your idea, though I'd made a mistake in the command I'd mentioned earlier. I used -k reconfigure not reload. I assume the /5 in cron is for check every 5 minutes? – Vijay Feb 1 '11 at 11:19

For test use wget and http_proxy

http_proxy="" wget -O /dev/null

For restart:

http_proxy="" wget -O /dev/null || squid -k reload
share|improve this answer
So I could do this with the crontab entry above thereby resulting in a check and fix soltuion? – Vijay Feb 1 '11 at 7:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.