LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-25-2002, 01:38 AM   #1
beep_beep
LQ Newbie
 
Registered: Aug 2002
Distribution: RH7.3; 8.0, SuSE 9.1
Posts: 26

Rep: Reputation: 15
Exclamation How to set variable permanently in rc.local(RH7.3)?


I want to install some variables permanently for all users
in my rc.local (RH 7.3)

For Example, I write in rc.local:
export SOME_VAR=/xxx/xxx/xxx
echo OK
sleep 3

During boot time I see "OK", but my variable don't appears
after I type "SET" in BUSH.
What happens?
How to do what I want?

If I write the same in SuSE's profile.local ,
everything works fine.Why?

Thanks.

Last edited by beep_beep; 09-25-2002 at 02:34 AM.
 
Old 09-25-2002, 01:59 AM   #2
RijilV
Member
 
Registered: Sep 2002
Location: somewhere
Distribution: gentoo
Posts: 123

Rep: Reputation: 15
rc.local != profile.local


try /etc/profile
 
Old 09-25-2002, 02:10 AM   #3
beep_beep
LQ Newbie
 
Registered: Aug 2002
Distribution: RH7.3; 8.0, SuSE 9.1
Posts: 26

Original Poster
Rep: Reputation: 15
I had to ask:

SuSe's profile.local loaded and run in boot time,
RH's rc.local loaded and run in boot time TOO,
What a difference?
 
Old 09-25-2002, 02:17 AM   #4
RijilV
Member
 
Registered: Sep 2002
Location: somewhere
Distribution: gentoo
Posts: 123

Rep: Reputation: 15
having never used SuSE I don't know.

My guess is that /etc/profile.local is not loaded at bootup, but rather loaded when the use logs in. Evidence: /etc/profile.local is outside of the rc script directory. /etc/profile.local suggests they don't want you touching the real /etc/profile.

but hey, I'm guessing, a quick google search didn't tell me what I wanted to know in regards to SuSE's init scripts. thumb through them, or better do a grep for profile.local in them

or just wait for someone who knows something about SuSE to come on and tell me I'm an idiot
 
Old 09-25-2002, 02:24 AM   #5
beep_beep
LQ Newbie
 
Registered: Aug 2002
Distribution: RH7.3; 8.0, SuSE 9.1
Posts: 26

Original Poster
Rep: Reputation: 15
Thank You, RijilV

Right! SuSe's profile.local works in etc/ directory and
may be loaded in time of login,
but what a difference ? Login time, boot time?
Anywhere those scripts use same bush commands.
Why in one case bush command works in other case
not completely works?
Thanks.
 
Old 09-25-2002, 10:34 AM   #6
RijilV
Member
 
Registered: Sep 2002
Location: somewhere
Distribution: gentoo
Posts: 123

Rep: Reputation: 15
well first let me give you a run down on the boot process of Linux.

|-BIOS hands off control to LILO
|-LILO passes control to the Linux Kernel
|-Kernel runs INIT as PID1
|-init
|-Runs rc files for correct runlevel example runlevel3
|-/etc/rc3.d/*
|-/etc/init.d/rc.local
|-runs login programs (generically 6 on most distros)
|-Login program sets enviroment (/etc/profile)
|-bash

When init is playing with the rc files, setting bash works, it just isn't carried over because there is really no "global" namespace for enviromental variables as such. rc.local does not call the login program, rather, init does.

rc.local can set variables that programs it calls can see and use, however since it isn't running the login programs the variables aren't passed down. Each time you run a shel, it has it's own enviromental variable set. Setting foo on terminal 2 won't change the enviromental variable set of terminal 1. This is generally considered a Good Thing (imagine a multi-user system).

Shell variables are inherited from the parent shell, if you su from your normal shell your foo variable will still be there.

What is happening is rc.local is a dead end in terms of progression, it is run, calls whatever programs you want, then dies (thereby loosing its enviromental variables) and returns control back to init.

I hope that helps, I gotta run to work thou
 
Old 09-25-2002, 11:35 AM   #7
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
Good job, RijilV!! Excellent post!

beep_beep... if your login shell was run by rc.local too, you'd have what you want, but as ain't the case ..
 
Old 09-25-2002, 12:35 PM   #8
beep_beep
LQ Newbie
 
Registered: Aug 2002
Distribution: RH7.3; 8.0, SuSE 9.1
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks, real help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set a background permanently in fluxbox Vincent Slackware 10 01-16-2004 12:32 PM
Store PATH variable permanently Skute Linux - Software 8 01-15-2004 04:05 PM
How to set path permanently for a particular user Sifvion Slackware 14 10-16-2002 11:02 AM
How to set PATH permanently chandhru Linux - Newbie 3 09-24-2002 12:43 AM
bsetbg, set background permanently nutshell Linux - General 2 06-13-2002 03:07 AM


All times are GMT -5. The time now is 12:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration