On Fri, Dec 16, 2011 at 09:18:39AM -0500, Jason F. McBrayer wrote:
> On Wed, 14 Dec 2011 18:47:44 +0100, Shark wrote:
> 
> > Now I have just another question: is there a way in polipo to
> > dynamically "understand" if there is connection or not?
> >
> > I don't want to set the "proxyOffline" to "yes" everytime I am 
> > offline
> > and to "no" when I return back online.
> 
> If you are running on a Unix-like system, there are probably scripts 
> that run automatically when your network interface goes up or down (to 
> handle the details of setting up the connection). On a current Linux, 
> this is usually done by NetworkManager; on other systems, there's likely 
> to be scripts with names like ifup-eth0 or such. You can add the curl 
> command line someone else mentioned in this thread to one of these 
> scripts.
> 

indeed, here athe few lines:

/etc/NetworkManager/dispatcher.d/25-polipo
#######################################
!/bin/sh

if [ "$2" = "up" ]; then
    http_proxy="" /usr/bin/curl -m 5 -d 'proxyOffline=false' 
'http://127.0.0.1:8123/polipo/config?' || :
    /usr/bin/logger "polipo configured as online" || :
fi

if [ "$2" = "down" ]; then
    http_proxy="" /usr/bin/curl -m 5 -d 'proxyOffline=true' 
'http://127.0.0.1:8123/polipo/config?' || :
    /usr/bin/logger "polipo configured as offline" || :
fi

#########

Richard

---
Name and OpenPGP keys available from pgp key servers


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to