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.
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.
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)