[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Startup script ?



"Marc Hultquist" <marc@cks.co.za> writes:

> Ok well using apt-get through the proxy here at work, finally
> started working, basically I had to import a global variable
>
> I.E export http_proxy="blabla/"
>
> Now what I wanted to ask, is how do I create a startup script in
> Debian, so that whenever the machine is re-started, rebooted or
> anything like that, that when it boots again that it will get the
> http_proxy for its global variable ? I.E where do I put the script
> and how do I make it so that the script is run everytime the machine
> restarts?

In Unix-like systems, there isn't really such a thing as a "global
variable".  Every process has a set of environment variables, and
child processes may or may not inherit the environments of their
parents, and processes are free to alter their own environments.

That said, if you just want your user ID to get that variable whenever
you login (this would work if your user ID was the one running
apt-get, say through 'su' or 'sudo'), then just put the statement in
~/.bash_login or ~/.bash_profile or whatever (salt to taste if you
don't use bash).  If there is some script that runs apt-get
automatically, just set the environment variable in that script.

The only reliable way that I know of to create an environment variable
that will get set whenever *lots* of users login, regardless of their
shells, is to use pam_env.  See /etc/pam.d/login,
/etc/security/pam_env.conf, and the libpam-doc package for more
information.  I'm not sure why you'd want to do this, though.

Lucas
-- 
Lucas Bergman <lucas@fivesight.com>
Tired of getting duplicate copies of mailing list messages?  I respect
the 'mail-followup-to' header field: http://cr.yp.to/proto/replyto.html



Reply to: