?
Solved

Ubuntu Server Linux: I want to automatically set two environmental variables at server startup

Posted on 2007-11-29
4
Medium Priority
?
820 Views
Last Modified: 2013-11-15
Is there some way for two particular environment variables to be set automatically on server startup?  (CVSROOT and CVS_RSH)

Thanks
0
Comment
Question by:oxygen_728
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Assisted Solution

by:Duncan Roe
Duncan Roe earned 600 total points
ID: 20372218
Sure - you can put them in /etc/profile.  The all Bourne-style shell logins will get them (including bash). There's another file if you use csh.
I think you could put them in an early rc file (in /etc/rc.d, varies with distribution) then all processes will get them (because init is the ancestor of all processes). But that's not the usual way.
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 1400 total points
ID: 20372233
Hi,

The /etc/profile file will be read when users login to the server. If you want to run a command or tool that will need these variables, then you set then in the script that call these commands or tools.

0
 

Author Comment

by:oxygen_728
ID: 20375199
Can you give me an example of what to put into /etc/profile to set the CVSROOT environment variable?

Do just throw the line "export CVSROOT=VALUE" into the file in a blank line?

Thanks for the help.

0
 
LVL 40

Accepted Solution

by:
omarfarid earned 1400 total points
ID: 20375771
Hi,

The /etc/profile is like the .profile file in the home dir of the user. It is read when the user is logged in and all commands in it are executed in the login shell.

So, it is as you described

But if you want to set variables for jobs / scripts that will run at startup, you need to add such statements to the scripts since the scripts do not read /etc/profile file.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question