On 03/04/2012 16:04, Osmany Goderich wrote:
> 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
you can use another query with a "like" or "regex" but you need to first
think of what you want to check and then try to let say split the url
into domain and url and then.
you can use sed or other stuff to use regular expressions but i would
recommend you warmly on trying to take the "basic_db_auth" perl script
and to modify it for your needs.
in a case of regular expression splitting it will be much easier ther.
this is the helper:
or:
good luck,
Eliezer
>
> 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
>
>
-- Eliezer Croitoru https://www1.ngtech.co.il IT consulting for Nonprofit organizations eliezer <at> ngtech.co.ilReceived on Tue Apr 03 2012 - 14:01:08 MDT
This archive was generated by hypermail 2.2.0 : Tue Apr 03 2012 - 12:00:02 MDT