> The init script will not see those variables when it is run by /sbin/rc
> which is in turn run by init which is what happens on boot. The
> environment is empty then, and if you want to reproduce it accurately
> for your tests, you should do:
> 
>       env -i /etc/init.d/test restart
> 
> It does see variables in /etc/rc.conf though:
> 
> lion ~ # echo LANGTEST=testme >> /etc/rc.conf
> lion ~ # env -i /etc/init.d/test restart
>  * Caching service dependencies ...                                           
>                              [ ok ]
> LANGTEST=testme
>     set | grep LANG

And the init-script will also see the variables from /etc/conf.d/test

But i cannot says, that i like the design.
Should init.d-scripts see the env-variables from the current
environment? I don't think so - even if it's usually root's environment.

/sbin/rc could clear the environment and source /etc/profile.env
instead. That would be pretty clever i think. An init-script would
always run within the same environment no matter whether it's run by
init or root's shell.

How about that?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to