Re: default environment for scripts?
On Mon, 22 Oct 2001, Norbert Veber wrote:
> On Sat, Oct 20, 2001 at 04:28:59PM +0200, Santiago Vila wrote:
> > On Thu, 18 Oct 2001, Tomas Pospisek wrote:
> >
> > > * Is there a standard way to define a default environment for /etc/init.d
> > > scripts? Is there any reason not to have a possibility to set such a
> > > default environment? If there isn't wouldn't it be a good idea to be
> > > able to define such an default environment in a standarized way?
> >
> > Maybe not. Policy says: "No program may depend on environment
> > variables to get reasonable defaults". I think this policy is good
> > even if there was a "standard way" to define environment variables.
> > (I remember the ms-dog days, when autoexec.bat became full of environment
> > variables of all kinds...)
Um yes I agree to some extent. But what do you say to the problem I
mentioned. I.e. how do you get to a *completely* (!) localised system
(*everything* in german) or where everything needs to access a let's say
NFSROOTed disk that has a different codepage or ...
?
> > I assume you can define whatever environment variables you really need
> > inside the init.d scripts that really need them, since they are
> > usually conffiles.
Yes, I can do that but:
1) it will be gone the next time I upgrade
2) the resulting error's are sometimes (as in cpio's case) quite subtle,
which makes them a pain to track them down
3) I'll have to do the same thing for every single programm that is called
*somewhere* from an non-interactive shell (daemons, children of
daemons, shellcalls from daemons, cron, etc.)
So the "this is your global environment act followingly" approach is IMO
cleaner.
> The initial environment comes from /etc/init.d/rcS, and is inherited by
> every init script, and used (unless the init script overwrites some/all
> variables).
Unfortunately that's not the case. I can set a variable in
/etc/init.d/rcS, export it there but I don't see it in a usershell.
Neither do I see it in a cronjob. (!)
*t
----------------------------------------------------------------------------
Tomas Pospisek
SourcePole - Linux & Open Source Solutions
http://sourcepole.ch
Elestastrasse 18, 7310 Bad Ragaz, Switzerland
Tel: +41 (81) 330 77 11
----------------------------------------------------------------------------
Reply to: