You are not logged in.

#1 2012-10-02 06:50:25

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

Change environment variables dynamically in X?

I'm using awesomewm started by GDM on a laptop.

I have to use a proxy server when at the office. To avoid having to change settings repeatedly I set up tinyproxy and point all my network-enabled tools to it (and restart it with different proxy settings in a script in netcfg). However, this approach is running into some problems).

Is it possible to change environment variables dynamically? For CLI programs I could just re-source a bash file which dynamically calculates the value of http_proxy (or takes it from a text file on each opening of a terminal. However, this wouldn't work for firefox/dropbox etc. which source http_proxy from (I think) the parent process, which is gdm or awesomewm in this case.

Any ideas?


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

#2 2012-10-02 07:05:20

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Change environment variables dynamically in X?

https://wiki.archlinux.org/index.php/Be … oxy_server

Speed differences could be because the company is throttling certain connections (some companies do this, to discourage Youtube, FarmVille and other distractions). Hmmm... But a 10% difference is probably something else. Maybe check your /etc/resolv.conf?

Edit: And maybe see this: http://askubuntu.com/questions/3554/how … connect-to

And this: http://marin.jb.free.fr/proxydriver/

Last edited by DSpider (2012-10-02 07:38:28)


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#3 2012-10-02 08:01:00

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

Re: Change environment variables dynamically in X?

DSpider wrote:

https://wiki.archlinux.org/index.php/Be … oxy_server

Speed differences could be because the company is throttling certain connections (some companies do this, to discourage Youtube, FarmVille and other distractions). Hmmm... But a 10% difference is probably something else. Maybe check your /etc/resolv.conf?

This is actually concerning my other thread smile. But in answer, no, same resolv.conf used in both cases. As I said there, I simply export a different value in http_proxy (no reconnection of any sort) and speed suddenly jumps.

Just about all of those things I've mentioned above as tried, except the .pac file. The problem with that is that it doesn't work generally for all graphical applications, just ones that understand it (like firefox, I believe chromium as well) while things like dropbox would not work.

Proxydriver seems very much gnome/kde linked, which isn't of much help when I'm running awesomewm.

Thanks for your answers, really, but still looking for something else. Latest idea I have is to replace dropboxd, firefox, and all the other executables with my own script which first sets up http_proxy and then runs the original executable. So something like this:-

#!/bin/sh

export http_proxy=`cat /path/to/the/desired/proxy/server/as/set/up/by/netcfg/hooks`

/usr/bin/firefox &

Any disadvantages to this method? Then I can just forget about using tinyproxy (wouldn't mind that at all, its been a pain sometimes, just dying in the middle of a big transfer). I could possibly also do away with the netcfg hook and just implement the checking logic (based on the IP range) in the bash script itself.


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

Board footer

Powered by FluxBB