Operating System - HP-UX
1844802 Members
1655 Online
110233 Solutions
New Discussion

Re: How can i set system wide Environment vars at boot ?

 
SOLVED
Go to solution
Stephane Vinsot
Advisor

How can i set system wide Environment vars at boot ?

I need to set some Environment variables for the full system at boot time, before starting the daemons like dtlogin for instance, without modifying each "rc" file...

How can i do that on HPUX 11 ?

Thanks
7 REPLIES 7
Alex Glennie
Honored Contributor

Re: How can i set system wide Environment vars at boot ?

create an executable file in the /etc/dt/config/Xsession.d
directory that sets and exports the variable.

eg, you create a file /etc/dt/config/Xsessions.d/myvars

containing export MYVARIABLE="value"

On restarting Xwindows (either go to init 2 and then back to init 3 or
kill the Xserver, MYVARIABLE will be set for each user.

Please give this a try, also refer to the CDE Advanced User's and System
Adminstrators Guide if you have a copy
Rick Garland
Honored Contributor

Re: How can i set system wide Environment vars at boot ?

Use the /etc/profile for system wide.
Use the $HOME/.profile for individuals.
Alan Riggs
Honored Contributor

Re: How can i set system wide Environment vars at boot ?

It is not a solution that I have ever needed to investigate, but /etc/rc.config is the file sourced by all standard startup scripts.
Alex Glennie
Honored Contributor

Re: How can i set system wide Environment vars at boot ?

the previous post was referring to setting Env Vars prior to login under a CDE session is this appropriate in your case ?
Alan Riggs
Honored Contributor
Solution

Re: How can i set system wide Environment vars at boot ?

To elaborate slightly -- there really is no "system wide environment".

Modifying /etc/profile will affect each individual use shell and each program/script that sources each config file.

Modifying the Xsessionsd will affect all Xwindow logins, including dtlogin, but not necessarily subshell thereof.

Modifying /etc/rc.config will affect the environments of all startup scripts that conform to standards.
Stephane Vinsot
Advisor

Re: How can i set system wide Environment vars at boot ?

thank you, but dtlogin was only an example...

the files /etc/profiles are used only when opening a shell, and it doesn't seem that the start of the rc files is done in a shell (my vars are not set).
Stephane Vinsot
Advisor

Re: How can i set system wide Environment vars at boot ?

ok i just had to add a script file in the /etc/rc.config.d directory

All the scripts placed there are "sourced" before the rc start.

Thanks to all