LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-08-2010, 03:30 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
Error Executing the script.


Hi ,
I m getting an error after executing the script.

My script.

Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file).
I have added public key to avoid ssh password and ssh without password working fine.


Code:
#!/bin/sh

fn_VMFind()
{
Date=`ssh -t -t -q root@$1 date`
echo $Date
}

while read line
do
fn_VMFind "$line"
done < SERVERNAMES
There are total 8 Server IP addresses mentioned in SERVERNAMES file.

Quote:
SERVERNAMES
10.180.5.231
10.180.5.232
10.180.5.233
10.180.5.234
10.180.5.235
10.180.5.236
10.180.5.237
10.180.5.238
output:

Code:
tcgetattr: Inappropriate ioctl for device
Thu Jul 8 13:59:13 IST 2010
It shows Date on Only first server.
What can be the issue?
 
Old 07-08-2010, 06:20 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,996

Rep: Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187
Well my question back to you would be if you execute the following:
Code:
ssh -t -t -q root@10.180.5.231 date
After running this are you back on your machine or still connected to server?
 
Old 07-08-2010, 06:21 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Just a guess:

After using ssh to login to the 1st server, don't you need to log out?

What happens if you do the commands manually? i.e. log into server#1, and get the date, then log in to #2
 
Old 07-08-2010, 10:34 PM   #4
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
VM_Date=$( ssh -T -q root@$1 date < /dev/null )
runs perfectly fine.
My problem is now solved.
 
  


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
Error executing Perl/CGI script loftus49 Fedora 6 06-10-2010 03:41 AM
Sntax error : unexpected end of file while executing shell script priyankarathi Linux - Newbie 5 04-21-2009 01:33 AM
Run an external script, without holding up the currently executing script onesikgypo Programming 2 03-07-2009 09:26 PM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 05:05 PM
Executing PHP script- error message vfulco Linux - Newbie 3 07-13-2004 10:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 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