find the server name a script is running on


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find the server name a script is running on
# 1  
Old 08-30-2006
find the server name a script is running on

Is there any kind of command I can use to find out the name or IP address of the server I am currently on? We have a script that exists on multiple servers and I'd like to set a variable differently based on what server I am on.
# 2  
Old 08-30-2006
What OS?

Even better than the IP would be the mac address of the network card. /sbin/ifconfig ought to work on a lot of systems to dump all sorts of info, but you can get more specific if you know the system.
# 3  
Old 08-30-2006
Code:
uname -n

Code:
hostname

Code:
getent hosts `hostname`

# 4  
Old 08-31-2006
thanks - that worked perfectly.
I'll remember to include my OS next time - it's sun solaris.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

Hi guys, So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies

2. UNIX for Dummies Questions & Answers

Transfer file from server B to server C and running the script on server A

I have 3 servers A, B, C and server B is having some files in /u01/soa/ directory, these files i want to copy to server C, and i want to run the script from server A. Script(Server A) --> Files at Server B (Source server) --> Copy the files to Server C(Target Server). We dont have RSA key... (4 Replies)
Discussion started by: kiran_j
4 Replies

3. Shell Programming and Scripting

Running a script from another server (sh)

I have a script where it finds the most current modified file in a directory, transfers that file into another server, then run a script which is on that another server. I can find the file and transfer it fine, but when it comes to running the script on the other server, it just doesn't work.... (2 Replies)
Discussion started by: kooshi
2 Replies

4. Shell Programming and Scripting

script for reading logs of a script running on other UNIX server

Hi, I have a script, running on some outside firwall server and it's log of success or failure is maintained in a file. I want to write a script which ftp that server and reads that file and checks the logs and if failure , I will send mail notification. Please let meknow if I am not... (1 Reply)
Discussion started by: vandana.parwani
1 Replies

5. Shell Programming and Scripting

How to stop a script running in remote server from local script

Hi, I have googled for quite some time and couldn't able to get what exactly I am looking for.. My query is "how to stop a shell script which is running inside a remote server, using a script"??? can any one give some suggestions to sort this out. (1 Reply)
Discussion started by: mannepalli
1 Replies

6. IP Networking

How to find out why the network was down?, now the server is up & running

Hi there, solaris server was not reachable. Now the server is up & running I have to investigate the network logs (where i can get these logs)as such network issues are happening frequently. How to find why the netwrok has gone down ?? Thanx (1 Reply)
Discussion started by: Iqan Zahera
1 Replies

7. Shell Programming and Scripting

Running a Script in a Remote server

I am trying to write a script that would let me run a command in a remote server using ssh. scriptA: (dcm2nii is a command that only works on the other server) dcm2nii a b c scriptB: (I run this one on the current server) ssh -X otherserver /home/abc/Desktop/scriptA But when I do ... (2 Replies)
Discussion started by: ZeroGPX
2 Replies

8. UNIX for Dummies Questions & Answers

How to find Packages running on a server

On a HP machine I used this /usr/sbin/cmviewcl But on a Sun machine what is the command to find out the packages installed on it. Thanks (4 Replies)
Discussion started by: venu_nbk
4 Replies

9. Shell Programming and Scripting

Running a script in a server from another server

Hi Guys Say I have two servers (A & B) and two scripts (script1 & script2). script1 will be running on server A and script2 will nbe running on server B. Now my need is to kickoff script2 (in server B) just after finishing running script1 (in server A) Any idea, how to achieve this?... (2 Replies)
Discussion started by: csaha
2 Replies

10. Shell Programming and Scripting

running a script on remote server.

I need to run a script on a remote server from my ksh script. The issue I'm having is that I need to logon to the remote server as a different user. (see the following) logged on to server 1 as adsmgr neet to log on to server 2 as odemgr run passwd_util.ksh Thanks in advance. (1 Reply)
Discussion started by: whited05
1 Replies
Login or Register to Ask a Question