Solved

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

Posted on 2007-11-29
4
815 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 34

Assisted Solution

by:Duncan Roe
Duncan Roe earned 150 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 350 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 350 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Upgraded from Debian 7 to 8.7 and got black screen 20 121
Redhat upgrade 1 68
Windows 10 linux VM 30 92
copying a file from root to ssh another server in centos 5 12
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
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.

734 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