LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Where to set environment for boot processes (https://www.linuxquestions.org/questions/slackware-14/where-to-set-environment-for-boot-processes-4175471187/)

narke 07-28-2013 03:26 AM

Where to set environment for boot processes
 
Hi,

Where is the right place to set some environments variables for boot processes (those started from /etc/rc.d/rc.[SM])? I think, /etc/profile is not suitable, since it only effects environments of login sessions).

Thanks in advance,

torimus 07-28-2013 06:10 AM

You can put them into corresponding init scripts or even in inittab itself. More important question - why do you need that, what are you trying to achieve ?

narke 07-28-2013 11:20 PM

Quote:

Originally Posted by torimus (Post 4998283)
You can put them into corresponding init scripts or even in inittab itself. More important question - why do you need that, what are you trying to achieve ?

Because this is embedded system, most programs started from init. Some environments dedicated to these program, such as MY_APP_DATA_PATH, need to be set correctly.

SAbhi 07-29-2013 12:03 AM

Quote:

Originally Posted by narke (Post 4998243)
Hi,

Where is the right place to set some environments variables for boot processes (those started from /etc/rc.d/rc.[SM])? I think, /etc/profile is not suitable, since it only effects environments of login sessions).

Thanks in advance,

well from all above description I assume you have a application and you want to set up a path variable for that before it executes after the systems boots up!! is this correct ? if not it is still not clear what you are trying to do, if you can explain a bit in brief your requirement we would help you better.

taking the first situation, you can write a simple script to set up the env. variable and place it inside /etc/profile.d/, your script will be called everytime at startup.

narke 08-02-2013 10:34 AM

Quote:

Originally Posted by SAbhi (Post 4998659)
well from all above description I assume you have a application and you want to set up a path variable for that before it executes after the systems boots up!! is this correct ? if not it is still not clear what you are trying to do, if you can explain a bit in brief your requirement we would help you better.

taking the first situation, you can write a simple script to set up the env. variable and place it inside /etc/profile.d/, your script will be called everytime at startup.

SAbih,

I think /etc/profile.d/* scripts will not be executed before /etc/rc.d/rc.M get executed, my application was started from rc.M. So, setting variables in /etc/profile.d/* does not help.

ponce 08-02-2013 11:20 AM

have you tried exporting the variables directly at the top of rc.M (or just before your application is started there)?


All times are GMT -5. The time now is 12:07 PM.