LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error Executing the script. (https://www.linuxquestions.org/questions/linux-newbie-8/error-executing-the-script-818651/)

pinga123 07-08-2010 03:30 AM

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?

grail 07-08-2010 06:20 AM

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?

pixellany 07-08-2010 06:21 AM

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

pinga123 07-08-2010 10:34 PM

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


All times are GMT -5. The time now is 02:20 PM.