LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-09-2014, 06:03 AM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 205
Blog Entries: 1

Rep: Reputation: Disabled
Problem in ssh to some IPs in a loop


I've used a while loop to ssh some IPs and doing the same commands via it.It works correctly, but when a IP is unreachable in my list, the loop would be finished!and does not ssh the rest IPs!!!
 
Old 04-09-2014, 06:11 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,755

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
Are you doing this in the command line? From a script?

Without knowing what you're doing we can't suggest fixes.
 
Old 04-09-2014, 06:46 AM   #3
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 205
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Are you doing this in the command line? From a script?

Without knowing what you're doing we can't suggest fixes.
Code:
ssh -n  $usr@$IP 'hostname;date +%T;head -1 /dev/ttyS1;uptime;last reboot|head -10' >rbt.txt
 
Old 04-09-2014, 08:17 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,755

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
And without seeing that line in the context of the script / loop it's pointless. I'm outahere.
 
  


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
SSh to some IPs in a script massy Programming 13 03-18-2014 07:18 AM
how to ssh multiple ips federico101 Linux - Newbie 7 09-24-2012 04:12 AM
how to allow IPs for ssh in SunOS nirmit Linux - Newbie 4 04-20-2009 03:45 AM
allow certain IPs to connect to ssh bytez Linux - Security 3 05-21-2007 10:15 AM
ssh using hostnames, not IPs shanenin Linux - Networking 3 04-11-2005 01:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:58 AM.

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