Squid - (time out) apos reiniciar o sistemas

1. Squid - (time out) apos reiniciar o sistemas

Carlos Eduardo Duarte Schwalm
krlsedu

(usa Ubuntu)

Enviado em 20/10/2009 - 18:41h

olá, gosto de desafios, por isso estou sempre testando coisas, montei um proxy, para testar meus conhecimentos, funcionou tudo numa boa, eu mesmo fui montando o squid.conf, mas o problema é que sempre que reinicio o sistema, tenho que da um "sudo /etc/init.d/squid stop" ai fica em wait, ai dou ctrl+c, e denovo "sudo /etc/init.d/squid stop", após dou um "sudo /etc/init.d/squid start" e tudo funciona numa boa, naofunciona com restart nem reconfigure. O problema 'e que se eu não fizer isso, a internet fica com "time out".
meu squid.conf


http_port 3128
visible_hostname Cau

cache_mem 64 MB
maximum_object_size_in_memory 10 KB
maximum_object_size 2000 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid 4000 16 256
cache_access_log /var/log/squid/access.log
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280

acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1863 # amsn
acl Safe_ports port 1234 # azureus entrada
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

acl permitidos url_regex -i "/etc/squid/permitidos"
http_access allow permitidos
#http_access deny all

#acl proibidos dstdom_regex "/etc/squid/proibidos"
#http_access deny proibidos

acl proibidos url_regex -i "/etc/squid/proibidos"
http_access deny proibidos

acl redelocal src 192.168.1.0/24
http_access allow localhost
http_access allow redelocal

http_access deny all


  


2. Re: Squid - (time out) apos reiniciar o sistemas

kleber galucio
klebrr

(usa Linux Mint)

Enviado em 20/10/2009 - 21:43h

o que tem no arquivo "/etc/init.d/squid" ?

eu uso o rcsquid com o conteudo abaixo

ps: squid instalado via codigo fonte (./configure --prefix-/usr/local/squid)
-------------------------------- arquivo rcsquid
#!/bin/sh
### BEGIN INIT INFO
# Provides: rcsquid
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Description: inicia o proxy squid 2.7
### END INIT INFO

case "$1" in
'start')
/usr/local/squid/bin/RunCache &
echo -e "squid iniciado..."
;;
'stop')
killall RunCache
/usr/local/squid/sbin/squid -k shutdown
echo -e "squid finalizado..."
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0

--------------------------------

Outra dica é limpar o arquivo messages
# echo >/var/log/messages

executar um dos comandos abaixo:
#squid -k reconfigure
#squid -k shutdow
#/etc/init.d/squid stop &

e verificar o arquivo messages novamente para ver os que ocorrerem
#cat /var/log/messages




3. Re: Squid - (time out) apos reiniciar o sistemas

Carlos Eduardo Duarte Schwalm
krlsedu

(usa Ubuntu)

Enviado em 20/10/2009 - 22:03h

verifiquei e tem o seguinte:


# Should-Start: $named
# Should-Stop: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Squid HTTP Proxy
### END INIT INFO

NAME=squid
DAEMON=/usr/sbin/squid
LIB=/usr/lib/squid
PIDFILE=/var/run/$NAME.pid
SQUID_ARGS="-D -YC"

[ ! -f /etc/default/squid ] || . /etc/default/squid

. /lib/lsb/init-functions

PATH=/bin:/usr/bin:/sbin:/usr/sbin

[ -x $DAEMON ] || exit 0

grepconf () {
w=" " # space tab
sq=/etc/squid/squid.conf
# sed is cool.
res=`sed -ne '
s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
t end;
d;
:end q' < $sq`
[ -n "$res" ] || res=$2
echo "$res"
}

grepconf2 () {
w=" " # space tab
sq=/etc/squid/$NAME.conf
# sed is cool.
res=`sed -ne '
s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
t end;
d;
:end q' < $sq`
[ -n "$res" ] || res=$2
echo "$res"
}

#
# Try to increase the # of filedescriptors we can open.
#
maxfds () {
[ -n "$SQUID_MAXFD" ] || return
[ -f /proc/sys/fs/file-max ] || return 0
global_file_max=`cat /proc/sys/fs/file-max`
minimal_file_max=$(($SQUID_MAXFD + 4096))
if [ "$global_file_max" -lt $minimal_file_max ]
then
echo $minimal_file_max > /proc/sys/fs/file-max
fi
ulimit -n $SQUID_MAXFD
}

start () {
cdr=`grepconf2 cache_dir /var/spool/$NAME`
ctp=`grepconf cache_dir ufs`

case "$cdr" in
[0-9]*)
log_failure_msg "squid: squid.conf contains 2.2.5 syntax - not starting!"
log_end_msg 1
exit 1
;;
esac

#
# Create spool dirs if they don't exist.
#
if [ -d "$cdr" -a ! -d "$cdr/00" ] || [ "$ctp" = "coss" -a ! -f "$cdr" ]
then
log_warning_msg "Creating squid cache structure"
$DAEMON $SQUID_ARGS -z
fi

if [ "$CHUID" = "" ]; then
CHUID=root
fi

maxfds
umask 027
start-stop-daemon --quiet --start \
--pidfile $PIDFILE \
--chuid $CHUID \
--exec $DAEMON -- $SQUID_ARGS < /dev/null
return $?
}

stop () {
PID=`cat $PIDFILE 2>/dev/null`
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name squid
#
# Now we have to wait until squid has _really_ stopped.
#
sleep 2
if test -n "$PID" && kill -0 $PID 2>/dev/null
then
log_action_begin_msg " Waiting"
cnt=0
while kill -0 $PID 2>/dev/null
do
cnt=`expr $cnt + 1`
if [ $cnt -gt 24 ]
then
log_action_end_msg 1
return 1
fi
sleep 5
log_action_cont_msg ""
done
log_action_end_msg 0
return 0
else
return 0
fi
}

case "$1" in
start)
log_daemon_msg "Starting Squid HTTP proxy" "squid"
if start ; then
log_end_msg $?
else
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping Squid HTTP proxy" "squid"
if stop ; then
log_end_msg $?
else
log_end_msg $?
fi
;;
reload|force-reload)
log_action_msg "Reloading Squid configuration files"
$DAEMON -k reconfigure
log_action_end_msg 0
;;
restart)
log_daemon_msg "Restarting Squid HTTP proxy" "squid"
stop
if start ; then
log_end_msg $?
else
log_end_msg $?
fi
;;
status)
status_of_proc -p "$PIDFILE" "$DAEMON" squid && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}"
exit 3
;;
esac

exit 0







Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts