Computing.Net > Forums > Solaris > variable not exporting during boot!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

variable not exporting during boot!

Reply to Message Icon

Name: MarcusTorres
Date: February 19, 2003 at 12:23:36 Pacific
OS: solaris 2.6
CPU/Ram: 440mhz/256mb
Comment:

I have a script in /etc/rcS.d which basically just sets a variable:

DISKSTATE="blah" ; export DISKSTATE

Then later during bootup, in /etc/rc3.d i have another script which calls that variable. The problem is , the variable is always empty. It's losing it's value even though i exported it early during bootup. How can keep the value of the variable throughtout the system bootup!? Any help would be greatly appreciated.

p.s. I've tried a workaround, instead of making a variable, i would write to a tmp file.... BUT...you cant write to the disk during bootup. why not?



Sponsored Link
Ads by Google

Response Number 1
Name: Mauro
Date: February 20, 2003 at 09:16:19 Pacific
Reply:

1. You can't set a variable in a script and then get its value in the other, because... this is the way it works! When you run a process (in this case a shell) it has its private environment, that is a memory area. In this env you can set variables for your private use. Exporting a variable simply means: when your process will span a new process, this will inherit your variable. In effect exporting is a way to pass parameters to your children processes (example: DISPLAY variable). See man page exec(2), the envp[] parameter.
2. I read in /etc/rcS.d/README, that after the execution of S30rootusr I have / and /usr mounted read-only. I think they will be mounted read-write by S40standardmounts.sh


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: variable not exporting during boot!

Solaris 2.6 boot problem www.computing.net/answers/solaris/solaris-26-boot-problem/1341.html

Start sshd during boot up www.computing.net/answers/solaris/start-sshd-during-boot-up/3898.html

Solaris 10 hang during boot www.computing.net/answers/solaris/solaris-10-hang-during-boot/4879.html