Thanx a lot.

This is the outcome. Finally it works

#/bin/bash
while read url
do
if [ `echo "select site from porn where site='$url'"|mysql squid -u squid 
-psquidpass|grep -v "site"` ]
then
echo OK
else
echo ERR
fi
done

But this is really not what I´m looking for. This scrip only compares what´s 
coming in from squid with what´s in the mysql table. That means that if the url 
is not exactly the same as the request it really does not work. So I´m looking 
to make something that works more like a url_regex acl that takes an element in 
the mysql table and sees if the request's url contains that element. With this 
working I'm sure it would make more sense since the comparisons would succeed 
without the need to fillup the table with millions of urls that otherwise would 
be blocked with just a limited number of strings

-----Mensaje original-----
De: Andrew Beverley [mailto:[email protected]] 
Enviado el: Monday, April 02, 2012 3:45 PM
Para: Osmany Goderich
CC: [email protected]
Asunto: Re: [squid-users] bash/mysql script not working

On Mon, 2012-04-02 at 14:28 -0400, Osmany Goderich wrote:
> Please have a look at this bash/mysql external helper. Can anyone tell 
> me why is it not working?
...
> is there anyway I can test this directly on the server's shell
> 

Yes, just run it on the shell as you would any other script, and input the 
expected values (as specified in squid.conf) followed by a carriage return. The 
script should return OK or ERR as appropriate.

Andy


Reply via email to