LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 03-21-2014, 04:04 PM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209
Blog Entries: 1

Rep: Reputation: Disabled
Working a script differently for two rang of IPs


Code:
 while read IP
 do
        rm -f rbtdate.txt
        rm -f rbt.txt
        ssh -n  $usr@$IP 'hostname;date +%T;head -1 /dev/ttyS1;uptime;last reboot|head -30' >rbt.txt
        host=`head -1 rbt.txt|cut -c 5-8`
        RSUname=`_RSUhostname`
This is the part of my script to do some commands via ssh and show some outputs, when I run it with IP rang in 192.168.40.X, it works correctly! But when I run it with 10.8.0.X, it remains in the orange line! and I should press Ctrl+c to continue the script and reading next IP via the loop.Before that the next IP would be read, the output is shown, but I want to run it automatically without pressing Ctrl+c !

Last edited by massy; 03-21-2014 at 04:07 PM.
 
Old 03-22-2014, 05:20 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
Code:
head -1 /dev/ttyS1
What do you think this line does?
 
Old 03-23-2014, 03:25 AM   #3
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Code:
head -1 /dev/ttyS1
What do you think this line does?
It reads a file that keep the temperature!
The script worked correctly before that I test it with IP range in 192.168.40.X !!!
 
Old 03-23-2014, 04:01 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
No, /dev/ttyS1 isn't a file that keeps the temperature.
 
  


Reply



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
Script to verify tunneled IPs are working ne0shell Programming 1 06-10-2012 08:27 AM
A script to check ports of a long range of IPs tirengarfio Linux - Networking 3 07-06-2009 10:48 AM
Routing : Route an ip differently from its ip range bala.linux Linux - Networking 3 05-07-2008 06:58 AM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM
Using IPCHAINS to allow only a range of IPs ganninu Linux - Security 1 01-13-2004 11:18 AM

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

All times are GMT -5. The time now is 04:40 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
Open Source Consulting | Domain Registration