我在ubuntu 8.10上运行的squid(2.7)代理因为我无法发现的原因而停止接受一段时间的在线新请求。 然而,做一个squid -k reconfigure立即解决问题。
现在我通过监视日志手动运行这个命令,如果5分钟内没有看到任何活动,我重新加载configuration。
现在,我寻求解决scheme,我有几个想法:
我转向你的scheme2)的解决scheme,因为我不明白鱿鱼足够1),并且我正在避免3)只要我可以。 有任何想法吗?
我在鱿鱼中遇到过类似的行为(大概是5年前 – 从来没有到底),但在我看来,它会在2-3天后开始放慢速度。
像这样从cron运行应该给予它完全locking所需的行为(假设它停止写入日志文件):
#!/bin/bash LOGFILE=/var/log/cache.log # you may need to change the above to point to your logfile LASTRUN=/var/local/squidcheck # above can be whatever - but dir must exist if [ ! -f ${LASTRUN} ] ; then touch ${LASTRUN} fi if [ ${LASTRUN} -nt ${LOGFILE} ] ; then /usr/sbin/squid -k reload fi touch ${LASTRUN}
这需要以root身份运行 – 所以无论是在根crontab或系统crontab …
*/5 * * * * /path/to/shellscript
(注意不要编辑crontab文件 – 使用crontab -l> copy_ctb获取当前crontab的副本,编辑它,然后使用crontab copy_ctb加载新configuration)
为了testing使用wget和http_proxy
http_proxy="http://127.0.0.1:3128" wget http://ya.ru -O /dev/null
重新启动:
http_proxy="http://127.0.0.1:3128" wget http://ya.ru -O /dev/null || squid -k reload