RE: [squid-users] bash/mysql script not working

From: Osmany Goderich <osmany_at_es.quimefa.cu>
Date: Tue, 3 Apr 2012 09:04:51 -0400

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:andy_at_andybev.com]
Enviado el: Monday, April 02, 2012 3:45 PM
Para: Osmany Goderich
CC: squid-users_at_squid-cache.org
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
Received on Tue Apr 03 2012 - 13:20:28 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 03 2012 - 12:00:02 MDT