You are not logged in.

#1 2012-09-03 09:00:38

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Proxy Rotator

In my bash scripts I am able to cycle through proxies with something simple like:

for line in $(cat $PROXY)
do
    export http_proxy="http://$line"
...

However, this type of loop will freeze the script if any of the proxies go off. Is there a proxy rotator program that will cycle through a list of proxies and keep switching to one with the best latency/one that isn't broken and then set it system wide?

I know there are proxy checker programs like proxy tester and libraries like libproxy and libwpad, but I'm not sure how to integrate them into my scripts.

Offline

#2 2012-09-03 09:10:05

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 6,818

Re: Proxy Rotator

rodyaj wrote:

However, this type of loop will freeze the script if any of the proxies go off.

I don't see how the lines you've quoted would freeze the script in any way. You're just exporting a particular value after all.

You probably mean that one of the (unshown) lines further down in the script which actually uses the proxy 'freezes' the script, probably due to some timeout. Just test the proxy using some resource (like the proxy tester you've referred to) before running your actual task, and skip past that proxy if its not working.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2012-09-03 09:15:50

rodyaj
Member
Registered: 2009-10-13
Posts: 54

Re: Proxy Rotator

ngoonee wrote:

You probably mean that one of the (unshown) lines further down in the script which actually uses the proxy 'freezes' the script, probably due to some timeout.

Well yes that is what I mean by the script freezing. I guess what I really need to do is add some sort of timeout to my script so that it will skip to the next proxy when the current one becomes unresponsive.

Last edited by rodyaj (2012-09-03 09:17:18)

Offline

Board footer

Powered by FluxBB