Solved

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

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

717 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