[arch-general] Setting global environment variable
I'm regularly connecting and disconnecting to a VPN using vpnc. The network I connect to has a transparent proxy which I want to set $http_proxy to. I thought I could do something like export http_proxy="proxy.whatever.com" in the /etc/rc.d/vpnc file, in the start and stop functions as necessary but exporting only makes the variable available to the child processes. Not to mention, I need this variable set for normal users also. Basically, I want to set and unset the variable when I connect and disconnect the VPN. Any ideas?
On Mon, Feb 1, 2010 at 17:11, Ty John <ty-ml@eye-of-odin.com> wrote:
Basically, I want to set and unset the variable when I connect and disconnect the VPN.
The best way is probably to have a set of aliases in your bashrc that run it and set the variables. Scripts and functions cannpt modify the calling environment.
On Mon, 1 Feb 2010 17:13:55 -0500 Daenyth Blank <daenyth+arch@gmail.com> wrote:
On Mon, Feb 1, 2010 at 17:11, Ty John <ty-ml@eye-of-odin.com> wrote:
Basically, I want to set and unset the variable when I connect and disconnect the VPN.
The best way is probably to have a set of aliases in your bashrc that run it and set the variables. Scripts and functions cannpt modify the calling environment.
Thanks Daenyth, I knew it would be something simple like that. Works perfectly.
On Mon, 1 Feb 2010 17:13:55 -0500 Daenyth Blank <daenyth+arch@gmail.com> wrote:
On Mon, Feb 1, 2010 at 17:11, Ty John <ty-ml@eye-of-odin.com> wrote:
Basically, I want to set and unset the variable when I connect and disconnect the VPN.
The best way is probably to have a set of aliases in your bashrc that run it and set the variables. Scripts and functions cannpt modify the calling environment.
Taking another look at this. It doesn't really work the way I had hoped. I can set the $http_proxy variable when connecting to the VPN but the variable is only valid from the bash shell it was called from. Is there no way to make existing processes acknowledge the variable? The main idea behind this is so that I can leave my browser running whether I'm connected to the VPN or not. Currently I have firefox with setup to connect to the proxy and I use another browser whenever I'm not connected (rather than changing the firefox network settings everytime).
Taking another look at this. It doesn't really work the way I had hoped. I can set the $http_proxy variable when connecting to the VPN but the variable is only valid from the bash shell it was called from. Is there no way to make existing processes acknowledge the variable?
no, environment variables are only inherited from the parent process
The main idea behind this is so that I can leave my browser running whether I'm connected to the VPN or not. Currently I have firefox with setup to connect to the proxy and I use another browser whenever I'm not connected (rather than changing the firefox network settings everytime).
Install the foxy-proxy extension for Firefox, it'll allow you to quickly change the proxy -- damjan
On Wed, 3 Feb 2010 11:03:01 +0100 Damjan Georgievski <gdamjan@gmail.com> wrote:
Install the foxy-proxy extension for Firefox, it'll allow you to quickly change the proxy
Thanks, I'll give it a crack
participants (3)
-
Daenyth Blank
-
Damjan Georgievski
-
Ty John