LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-28-2012, 01:58 PM   #1
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Rep: Reputation: Disabled
Unable to connect morethan a server via remotely and get the result


Hello
Have a question.

Please refer my code

#!/bin/sh
i=1
while read line
do
echo "$i:$line";ssh $line 'nvidia-smi |grep -i MB | cut -c40-55'
let i++
done < ~/hostnames

There are ~100 server , i want remotely loginto all servers one by one and get the nvidia details, when i execute the above scrips it just fetch the details from one server post it quite, it does not heading to second server listed in hostnames file.

Please correct where i was wrong and wt should i do to fulfill my request
 
Old 12-28-2012, 05:23 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Please post a fragment of the output, and the hostnames file (in [CODE] [/CODE] tags please, to preserve formatting for those who will test the data).
--- rod.
 
Old 01-02-2013, 04:34 AM   #3
Srinivas Gadi
LQ Newbie
 
Registered: Dec 2012
Posts: 22

Original Poster
Rep: Reputation: Disabled
Output should be as follows
1 144MB / 511MB
2 144MB / 511MB
3 144MB / 511MB

here is the hostname file
MM31.hyd
MM16.hyd
MM54.hyd
MM86.hyd
 
Old 01-02-2013, 12:14 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,811

Rep: Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190
Quote:
Originally Posted by Srinivas Gadi View Post
Output should be as follows
1 144MB / 511MB
2 144MB / 511MB
3 144MB / 511MB

here is the hostname file
MM31.hyd
MM16.hyd
MM54.hyd
MM86.hyd
...and you didn't post the output you are getting, as was requested. Without knowing what it's doing, we can't help.

And again, please use CODE tags.
 
Old 01-02-2013, 12:39 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Does it quit after displaying output of first server, or stuck after that? Perhaps, it's not able to connet to second server...
Once add set -xv to debug the code, as:
Code:
#!/bin/sh
set -xv
i=1
while read line
do
echo "$i:$line";ssh $line 'nvidia-smi |grep -i MB | cut -c40-55'
let i++
done < ~/hostnames
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New ISP / modem... Unable to connect to ssh server (or ping) remotely Lyle Linux - Networking 6 03-07-2011 01:04 PM
unable to connect remotely mahmoodn Ubuntu 6 10-30-2010 12:48 AM
[SOLVED] Unable to remotely connect to X hejo Linux - Networking 1 05-26-2010 03:30 AM
Help: Unable to connect remotely tejpatil Linux - Newbie 3 02-14-2004 08:36 PM


All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration