Getting hostname using ssh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting hostname using ssh
# 22  
Old 06-30-2011
why would it...if when I run it manually it works out great!!
# 23  
Old 06-30-2011
Quote:
Originally Posted by eponcedeleonc
why would it...
Why would what?
Quote:
if when I run it manually it works out great!!
What are you running manually?

Do you have the output from hexdump -C that I asked for?
# 24  
Old 07-01-2011
I ran the script with little modifications and it is working fin now...

thanks for all your helpSmilie Corona688

What is the difference from this line
Code:
ssh $host exec /bin/sh -s $HOSTNAME 2>&1

to this line?
Code:
ssh $host exec /bin/sh -s $HOSTNAME 2>/dev/null


Last edited by radoulov; 07-01-2011 at 01:29 PM.. Reason: Code tags.
# 25  
Old 07-01-2011
Quote:
Originally Posted by eponcedeleonc
I ran the script with little modifications and it is working fin now...

thanks for all your helpSmilie Corona688

What is the difference from this line
Code:
ssh $host exec /bin/sh -s $HOSTNAME 2>&1

to this line?
Code:
ssh $host exec /bin/sh -s $HOSTNAME 2>/dev/null

One of them sends standard error into /dev/null, which basically gets rid of them. I'd been trying to keep those lines -- the "echo stuff >&2" in the <<EOF block -- and send them into your logfile, but if that was the line that fixed it, they must have been ending up in the gzip instead. Sigh. Smilie
# 26  
Old 07-01-2011
Quote:
send them into your logfile, but if that was the line that fixed it, they must have been ending up in the gzip instead. Sigh
How can I send the input of the remote server into my logfile. No output was sent to the gzip files, since the html files look ok.
# 27  
Old 07-04-2011
The way it was originally? ssh $host exec /bin/sh -s $HOSTNAME 2>&1 ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Get ip of client, not hostname

Hello i'm trying to get the ip of a telnet session. With who -u I get the hostname of the user connecting to my server, because it checks the reverse DNS. But I only want the ip. Versions: HP-UX HP Release B.11.31 Who command: Hewlett-Packard Company - 4 - HP-UX 11i Version... (2 Replies)
Discussion started by: boltpower
2 Replies

2. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies

3. AIX

Hostname for each lpar

Hi Gurus, Can a AIX server with 4 LPARs, each having it's own hostname on the same physical host. Is this possible? Thanks, S (2 Replies)
Discussion started by: svajhala
2 Replies

4. UNIX for Advanced & Expert Users

$HOSTNAME empty while invoking script using SSH

Hi, I am unable to get $HOSTNAME value in a remote script when executed through SSH. Also the scripts hangs and doesnt return to the calling environment. For instance command - ssh user1@box2 "cd /var/home/bin ; ./generateScript.sh" Can any one plese throw light on the issue and... (5 Replies)
Discussion started by: mihirvora16
5 Replies

5. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

6. Solaris

Changed hostname to -a

I was trying to execute the following command ifConfig -a and after a while my hostname changed to -a I checked /etc/hosts and /etc/nodename all seems to be correct. 1. How my hostname changed to -a ? (What i could have done wrong) 2. if you type hostname where does solaris read... (1 Reply)
Discussion started by: 2sb
1 Replies

7. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

8. UNIX for Advanced & Expert Users

Change of Hostname

Dear All. I will like to know beside the following command "hostname hostname" what other command that can change the hostname of the Unix. Thanks. (4 Replies)
Discussion started by: gelbvonn
4 Replies

9. IP Networking

looking up hostname

Using Solaris 8 (or WINXP). I am trying to look up a specific DNS hostname, but I don't know which DNS server houses that entry. How can I find the hostname? nslookup gives me the following: C:\>nslookup hostname Server: dnsserver Address: x.x.x.x *** dnsserver can't find hostname:... (2 Replies)
Discussion started by: dangral
2 Replies

10. UNIX for Dummies Questions & Answers

Hostname

Hello, I am installing redhat linux 6.2 on an intel based system. Whether i want to know any naming conventions should i follow. ie Any convention to follow to name a linux machine(To give hostname). Simillarly for domain name also. Please suggest in this regard (1 Reply)
Discussion started by: bache_gowda
1 Replies
Login or Register to Ask a Question