Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server or environment determination 2

Status
Not open for further replies.
Oct 10, 2003
2,323
US
Is there an internal shell command or env variable that can tell me which server I am on?
Objective – use the server name as a switch to populate various environment variables for development, QA/test, or production as applicable.
If not, any ideas?


-------------------------
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright
 

Did you try hostname? [3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thanks for your suggestion, however, my SA is telling me that if we switch to virtual names for high availability, then hostname (as well as uname -n) will not work.

-------------------------
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright
 

Create your own environment variable (HOST maybe) and set it in the /etc/profile script. [bigglasses]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
OR (in addition to LKBrwnDBA's post) write a simple file in /etc/me.txt and write down the server name into it? and make a simple script called [tt]servername.sh[/tt] with [tt]cat /etc/me.txt[/tt]

Chacal, Inc.[wavey]
 
Thanks. Sometimes the simple solution can get lost in the mix.

-------------------------
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top