Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-29
4
Medium Priority
?
826 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

610 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